TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
David Smith
NA
2k
0
Description Attribute
Oct 15 2010 11:05 AM
lolol a lil complicated for me what if i do something like this, Im having a lil trouble with it, can you tell me what im doing wrong
public enum ValidAnimals
{
[Description("BEAR")] A =
0x0000
,
//is there a way to get the description base off of the 0x0000
[Description("DOG ")] B = 0x0001,
[Description("CAT ")] C = 0x0002,
}
public string GetName(string Value)
{Value ="0000";
FieldInfo fi = stringValue.GetType().GetField(Value);
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
return (attributes.Length > 0) ? attributes[0].Description : stringValue;
}
im basically get a 4 nibble string, and I want to do a look up via the above enum, so like "0000" means Bear, Bear is the value i want to get back
Reply
Answers (
4
)
Prevent this "Internet Explorer needs to resend the information you've previously submitted" Dialog box from popping when i refresh my page
Multiple user access for single file