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 Attr
Oct 16 2010 12:02 AM
it blows up at this line when i enter in 00AA or 0x00AA, i guess its not really possible to put a enumeraton out of order
string value = commonFunctions.GetTestName((Dictionary.Common.ValidtTest)Enum.Parse(typeof(Dictionary.Common.ValidTest), "00AA"));
public enum ValidTest
{
[Description("TEST_A")] CAT = 0x0000,
[Description("TEST_B")] DOG = 0x00AA,
[Description("TEST_C")] BEAR = 0x0002,
}
public string GetTestName(Enum eventValue)
{
ValidTest vtn = (ValidTest)eventValue;
// Get the type
Type type = eventValue.GetType();
// Get fieldinfo for this type
FieldInfo fieldInfo = type.GetField(vtn.ToString());
// Get the stringvalue attributes
DescriptionAttribute[] attribs = fieldInfo.GetCustomAttributes(
typeof(DescriptionAttribute), false) as DescriptionAttribute[];
// Return the first if there was a match.
return attribs.Length > 0 ? attribs[0].Description : null;
}
Reply
Answers (
2
)
Cross Langauge Interoperablity and Cross Langauge Integration
Why i cant update data in grid view only ,and i only can delete data. please help me... i used asp.net with acess.mdb