I have this method:
internal static void AssignNewArrayItem(ref Xml.CLASSNAME[] Items, Xml.CLASSNAME Item)
{
if (Items != null)
{
Array.Resize(ref Items, Items.Length + 1);
Items[Items.Length - 1] = Item;
}
else
Items = new Xml.CLASSNAME[] { Item };
}
At the moment I have about 10 overloaded versions where CLASSNAME is different but they all do the exact same thing. Is there any way I can have CLASSNAME as a generic object and cast the vars to achieve the same result?
I am open to other suggestions to acheive the same result if I am going about this in the wrong way as well.
1 Answer