I have a component class with say two attributes, fieldValue and fieldType. This is how my code looks like:
private string fieldValue;
public string FieldValue
{
get { return fieldValue; }
set { fieldValue = value; }
}
public enum DataTypes
{
String,
Integer
}
private DataTypes fieldType;
public DataTypes fieldType
{
get { return fieldType; }
set { fieldType = value; }
}
The thing is I want my enum to be of standard C# datatypes like string, Int32, long etc., but I m not able to do that. I want my users to select the fieldType from a drop down list and that should contain almost all the possible C# datatypes. How would I do that
Thanks a lot !!

Component class, list of values to an attribute.
R Raghu
I could be misunderstanding but you cant make your enum values built into the .NET Framework (this is where VB.NET/C#/.NET based languages get the values from) - you can create your own enum yes, which will be shown in the autocomplete box (intellisense) along with the other code
Example:
public Enum EnumName
{
Enum1,
Enum2
}
and so on
fighter92
>>The thing is I want my enum to be of standard C# datatypes like string, Int32, long etc., but I m not able to do that. <<
I'm a bit confused. I think we can help to better, if you told us what stopping you from doing this.
sroughley
Twanks
This is pretty much what I need to do:
Design time support to my component.
It has three fields:
fieldName -- e.g. lID, sName
fieldValue -- e.g. 1, Dynamite
fieldType -- e.g. int16, string
fieldName, fieldValue are strings, so I did not have problems in adding them as attributes to my component.
For fieldType, i would like a dropdown list that lets the user select one from a list of possible C# primitive types.
I cannot make an enum of primitive types and that is why I was wondering what to do.
Thanks for your replies though !!
JIM.H.
Boban: Imagine creating a component with two attributes. A value and a type for that value. How will you go about that
From my field of investigation, I get a set of parameters, few of them bool,few of them integer, few of them string etc..,
I needed a component out of that parameter and hence I needed two fields. One to store the actual value and the other to store the type(int/string/bool) of that particular parameter.
Thanks a lot guys as always you guys have been very helpful !!
jamba8
WaitWaitWait.... Now I think I figured it out. I think he wants:
public enum DataTypes : Type
{
String = typeof(String),
Integer = typeof(Int32),
Long = typeof(Int64)
// etc.
}
Which of course is not allowed. I think the best way to pull this off would be to have a simple enum, and than a Dictionary<DataTypes, Type> to map one to the other.