I am not even sure how I should formulate this question. I pass some CustomStruct objects as parameters to the class method and store them in a list. I am wondering if it is possible and more efficient to add multiple references to a specific instance of CustomStruct if it was found by an equivalent instance.
This is a dummy / sample structure:
public struct CustomStruct
{
readonly int _x;
readonly int _y;
readonly int _w;
readonly int _h;
readonly Enum _e;
}
Using the following method, you can pass one, two, or three CustomStruct objects as parameters. In the final method (which takes three parameters), maybe the third and perhaps the second will have the same meaning as the first.
List<CustomStruct> _list;
public void AddBackground(CustomStruct normal)
{
AddBackground(normal, normal, normal);
}
public void AddBackground(CustomStruct normal, CustomStruct hover)
{
AddBackground(normal, hover, hover);
}
public void AddBackground(CustomStruct normal, CustomStruct hover, CustomStruct active)
{
_list = new List<CustomStruct>(3);
_list.Add(normal);
_list.Add(hover);
_list.Add(active);
}
, , CustomStruct, .
, , ( ) , , , </STRONG > . active.
, ? CustomStruct - ValueType, , . , . "" CustomStuct, .
CustomStruct , . , ? , CustomStruct, AddBackground (normal) , Addbackground (, , ). . Add(), , Add(), , ?
? , ?
- ?