getcustomattributes

How do I GetCustomAttributes?

I have tried the following code using the 2.0 framework and I get an attribute back, but when I try this on the compact framework, it always returns an empty array. The MSDN documenation says its supported, am I doing something wrong? Test x = new Test(); FieldInfo field_info = x.GetType().GetField("ArrayShorts"); object[] custom...

VB.net Values of Custom Attributes

Hey, I'm new to custom attributes, so I'm wondering if it is possible to get the values of the attributes. An example of the properties in my class which I use the custom attributes is: Private mFiller As String <Position(378), Length(34), DataType("A"), ParticipantDependant("P/D"), RequiredProperty("Required"), Format("Blank")> _ Publ...

System.Type.GetCustomAttributes on an assembly loaded from a network share is not showing all attributes

I have a managed dll – repro.dll, which contains class TestModuleCommand decorated with 2 attributes: System.ObsoleteAttribute and System.Management.Automation.CmdletAttribute (comes from System.Management.Automation.dll which is in the GAC in Windows 7) namespace Test { [System.Obsolete] [System.Manageme...

C# - Silverlight - CustomAttribute with Enum

I have the following class: [MetadataAttribute] [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] public class ModuleActivationButtonAttribute : ExportAttribute { public Enum TargetRegion { get; set; } public ModuleActivationButtonAttribute(Enum targetRegion) : base(typeof(IModuleActivationButton)) { ...