Questions tagged [getcustomattributes]

21 questions
1
vote
2 answers

C# GetCustomattributes from class name

Is it possible to get the custom attributes from the class name as a string? something like this (which doesn't work) Type myType = Type.GetType("MyClass"); MemberInfo info = myType // typeof(myType); object[] atts = info.GetCustomAttributes(true);
user2707101
  • 28
  • 1
  • 5
0
votes
1 answer

Getting a specific attribute instance using ConditionString

This might be a silly question. I am trying to understand the concept of conditional attribute.My aim is to get a specific attribute instance and ended up in getting NullReferenceException instead of the output "CONDITION1". class Program { …
Dev
  • 1,451
  • 20
  • 30
0
votes
1 answer

Calling Custom Assembly Attributes

I have created a custom attribute and use it in the AssemblyInfo.vb file. The attribute is declared in another file like so: Public NotInheritable Class AssemblyBuildNameAttribute Inherits Attribute Private _p1 As String Sub New(p1 As…
aaronmallen
  • 1,418
  • 1
  • 12
  • 29
0
votes
1 answer

GetCustomAttributes does not find Attribute when called through TeamBuild

This is way out there but maybe someone has seen this. Maybe someone have some additional debugging ideas for GetCustomAttributes failures. Assembly.GetCustomAttributes(Assembly, Type) returns nothing on a particular machine when called through…
learnerplates
  • 4,257
  • 5
  • 33
  • 42
0
votes
2 answers

How to reverse resolve custom attributes?

i have an enum with custom attributes, something like: public enum EnumStatus { [CharValue('*')] Empty, [CharValue('A')] value1, [CharValue('P')] value2, } the "forward" way seems easy, coming with an enum value an…
Mare Infinitus
  • 8,024
  • 8
  • 64
  • 113
-2
votes
2 answers

Assembly.LoadFrom get Custom Attribute

Question: using only Assembly.LoadFrom and having only the name of a custom attribute how can I find and then instantiate any classes with that named custom attribute? Code in DLL: [AttributeUsage(AttributeTargets.All)] public class ClassAttribute :…
FoolongC
  • 25
  • 3
1
2