I basically want to inject an extension method to each copy of ArrayList, which would perform the following behavior:
ArrayList ourList = new ArrayList();
ourList.Add(randomarray or random arraylist);
It'd add the CONTENT of the given array, arraylist or stack to 'ourList' and not the array, arraylist or stack itself.
However, my problem is:
How do I inject an extension method ONLY into the instanced class? The following code adds the method to the ArrayList baseclass and any instanced copy, however I want it to be ONLY available when you access an instanced copy of the class.
public static void Add(this ArrayList ourlist){
}
ArrayList.Add(); // Works, but shouldn't
ArrayList result = new ArrayList();
result.Add(); // Works
So, how do I manage this?