I've been developing in C# for quite a while and I'd say that I have a pretty decent grasp on most things C# and .NET related. However, there is one issue I can't seem to solve. I've tried to look through the Microsoft documentation (although not for a very thorough period of time) so I figured I'd just suck up my pride and ask my fellow coders.
My question-- How do I instantiate an array of an object (without using the .NET Array class) when the object has a constructor that must take parameters.
I know I'm not always the best at wording things so let me give an example. Let's say class foo has the following declaration:
public class foo {
...
//Constructor
public foo(int i) {
...
}
...
}
How can I declare an array of class as such:
foo[] f = new /*I don't know what to do here.*/;
Any help would be appreciated. Thanks!
Loading
RichardPosted Apr 6, 2006, 1:23 PM
Mahesh ChandPosted Apr 5, 2006, 4:03 PM
Here are some articles on generics:
http://www.c-sharpcorner.com/Code/2004/March/GenericsInCSharp.asp
http://www.c-sharpcorner.com/UploadFile/Ashish1/generics02012006132133PM/generics.aspx?ArticleID=80d92c07-26d7-4500-9c0e-5abdc9108650
http://www.c-sharpcorner.com/UploadFile/jgodel/Page102062006170216PM/Page1.aspx?ArticleID=16788ed3-c139-414f-abfe-f147d7a80006
Mahesh ChandPosted Apr 5, 2006, 3:59 PM
RichardPosted Apr 5, 2006, 8:43 AM