B
Bill
I would like to create a static array of classes (or structs) to be used in
populating name/value pairs in various WebForm drop down list boxes, but am
not quite sure of the construct (or rather to use structs instead of classes
in the array insofar as structs vs. classes appears to be controversial in
C# -- with some recommending avoiding structs altogether).
It needs to be an array something like this:
struct NoteValue
{
public byte ID;
public string Name;
}
public class NoteValues
{
public static readonly NoteValue[] NoteValuesList
{
{10, "Company"}, {15, "Location"}, {20, "Customer"};
}
}
This obviously does not compile, but should give an idea of what I'm TRYING
to accomplish.
Does anyone know the proper syntax to make this happen?
populating name/value pairs in various WebForm drop down list boxes, but am
not quite sure of the construct (or rather to use structs instead of classes
in the array insofar as structs vs. classes appears to be controversial in
C# -- with some recommending avoiding structs altogether).
It needs to be an array something like this:
struct NoteValue
{
public byte ID;
public string Name;
}
public class NoteValues
{
public static readonly NoteValue[] NoteValuesList
{
{10, "Company"}, {15, "Location"}, {20, "Customer"};
}
}
This obviously does not compile, but should give an idea of what I'm TRYING
to accomplish.
Does anyone know the proper syntax to make this happen?