Hey guys I have been looking all day for something that can explain a little better how I can do this problem I am having.
I have two Class’s that contains lists that will function as abstract AI variables, And I want to make a generic method to handle something like this:
class AddToList<T>
{
T _value;
private List<string> _NameOfEntity = new List<string>();
private List<int> _AgeOfEntity = new List<int>();
public void AddToList(T t)
{
listInt.Add(_value);
}
}
AddToList<string> addToList = new AddToList<string>{"Name"};
Or
AddToList<int> addToList = new AddToList<int>{18};
That would be able to grab the Int or the string and add it to the correct list. I am trying to understand this better so any help would be greatly appreciated.