Home > Net >  The attribute? The Description is what mean?
The attribute? The Description is what mean?

Time:01-20

The attribute of the following code? The Description of the? What's that mean?

 public static string GetDescription (Enum value, Boolean nameInstead=true) {
Try {
Type Type=value. GetType ();
String name=Enum. GetName (type, value);
If (name==null) {
return null;
}

System. Reflection. FieldInfo field=the GetField (name);
DescriptionAttribute attribute=System. Attribute. GetCustomAttribute (field, typeof (DescriptionAttribute)) as DescriptionAttribute;

If (attribute==null & amp; & NameInstead==true) {
return name;
}
The return attribute? . The Description;
} catch {
Return a string. The Empty;
}
}
  •  Tags:  
  • C#
  • Related