A
AliR \(VC++ MVP\)
Hi Everyone,
I have a class that has two instance variables that are Dictionaries. Now
in addition to having properties to access these dicitionaries, I wanted to
have a properties. But it seems like there can only be one in the class. Am
I missing something?
public class LSItem
{
enum DrawingAttributes { PenWidth, PenColor, FillColor,
TransformA..... };
private Dictionary<DrawingAttributes, float> attributes;
private Dictionary<DrawingAttributes, float> otherattributes;
//I know that I can have an index like so
public float this[DrawingAttributes i]
{
get { return attributes; }
}
//I would have thought that I could do this:
public float DrawingAttribute[DrawingAttributes i]
{
get {...}
set {...}
}
public float OtherAttribute[DrawingAttributes i]
{
get {...}
set {...}
}
}
That way I could have
LSItem item = new LSItem();
float penWidth = item.DrawingAttribute[LSItem.DrawingAttributes.PenWidth];
AliR.
I have a class that has two instance variables that are Dictionaries. Now
in addition to having properties to access these dicitionaries, I wanted to
have a properties. But it seems like there can only be one in the class. Am
I missing something?
public class LSItem
{
enum DrawingAttributes { PenWidth, PenColor, FillColor,
TransformA..... };
private Dictionary<DrawingAttributes, float> attributes;
private Dictionary<DrawingAttributes, float> otherattributes;
//I know that I can have an index like so
public float this[DrawingAttributes i]
{
get { return attributes; }
}
//I would have thought that I could do this:
public float DrawingAttribute[DrawingAttributes i]
{
get {...}
set {...}
}
public float OtherAttribute[DrawingAttributes i]
{
get {...}
set {...}
}
}
That way I could have
LSItem item = new LSItem();
float penWidth = item.DrawingAttribute[LSItem.DrawingAttributes.PenWidth];
AliR.