C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




enumerations


Posted Date: 08 Jul 2008      Total Responses: 2

Posted By: tejaswini       Member Level: Bronze     Points: 1



Thanks for ur reply

if i use like tht it wil throw error ..

Error 1 The name 'captain' does not exist in the current contextError 2 The name 'fe' does not exist in the current context
Error 3 The name 'f' does not exist in the current context
Error 4 The name 'a' does not exist in the current context
Error 5 The evaluation of the constant value for 'EDS.AE.Plotter.BO.SeniorityListIndicator.S' involves a circular definition
Error 6 'EDS.AE.Plotter.BO.SeniorityListIndicator' does not contain a definition for 'A'
Error 7 The name 'a' does not exist in the current context





Responses

Author: vipul    08 Jul 2008Member Level: DiamondRating:     Points: 6

hi,
sorry it is my mistake you don't use direct string into enum for that you used this way
using System.ComponentModel;
public partial class zzTest : System.Web.UI.Page
{
public enum Foobar
{
[Description("captain")]
C = 1,
[Description("fe")]
E = 3,
}

protected void Page_Load(object sender, EventArgs e)
{
Response.Write(GetDescription(Foobar.C));

}
public string GetDescription(Enum value)
{
System.Reflection.FieldInfo fi = value.GetType().GetField(value.ToString());
System.ComponentModel.DescriptionAttribute[] attributes =
(System.ComponentModel.DescriptionAttribute[])fi.GetCustomAttributes(
typeof(System.ComponentModel.DescriptionAttribute), false);
return (attributes.Length > 0) ? attributes[0].Description : value.ToString();
}

}


Patel Vipul
Web Developer
Ahmedabad ( Gujarat )



Author: tejaswini    08 Jul 2008Member Level: BronzeRating:     Points: 3

hi... still i'm getting the same error


Error 1 The type or namespace name 'UI' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)



Post Reply
You must Sign In to post a response.
Next : enumerations
Previous : enumerations
Return to Discussion Forum
Post New Message
Category: WCF

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use