i decared a custom attribute class:
now, just above the class that i want to use the custom attribute i place the line:
i read in the assembly data for the assembly that uses the custom attribute,but i cant find out how to access my custom attribute ( before i instantiate the class).it is being used to identify the class in order to see if its the one i want to create an instance of.
C#:
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Field|AttributeTargets.All, AllowMultiple = false)]
public class AssemblyTypeName : System.Attribute
{
string itemName;
public string NameOfClass
{
get
{
return itemName;
}
}
public AssemblyTypeName(string nameOfClass)
{
itemName = nameOfClass;
}
}
now, just above the class that i want to use the custom attribute i place the line:
C#:
[ AssemblyTypeName("BusinessEmployee")]
i read in the assembly data for the assembly that uses the custom attribute,but i cant find out how to access my custom attribute ( before i instantiate the class).it is being used to identify the class in order to see if its the one i want to create an instance of.
Last edited by a moderator: