It's a side issue (BoltClock has it right), but change this: List vectorList = new List(); vectorList. Capacity(100) To this: List vectorList = new List(100) Also, remove the T from your class name.
It's a side issue (BoltClock has it right), but change this: List vectorList = new List(); vectorList. Capacity(100); To this: List vectorList = new List(100); Also, remove the from your class name.
Happens to be the source of the two errors OP lists under my answer. Those errors would explain why he had the using directive in the first place. – BoltClock Jan 25 at 19:29 This worked PERFECTLY!
Thank you so much. – Cistoran Jan 25 at 19:30.
Remove that using line; List is a class, not a namespace so you don't have to "use" it. Your Main() method ought to belong in its own class too; C# does not allow redefining an existing class to add a Main() method. Also, Joel Coehoorn's answer will solve the problem you're having that I believe made you put that using line there in the first place, and LBushkin's advice is worth heeding.
When I remove the line it gives me two more errors. 'System.Collections.Generic. List' does not contain a definition for 'Capacity' and no extension method 'Capacity' accepting a first argument of type 'System.Collections.Generic.
List' could be found (are you missing a using directive or an assembly reference? ) and an error that reads just like that except Add is in place of Capacity. – Cistoran Jan 25 at 19:26 @Cistoran: Joel Coehoorn has the solution in his answer.
– BoltClock Jan 25 at 19:28.
There are a number of things you're doing here that aren't a good idea, and are directly responsible for some of the errors you're going to get. First, in C#, the using directive is intended to identify an entire namespace that you will depend on - and all of the types exposed in that namespace. The line using System.Collections.Generic.
List doesn't refer to a namespace, but to a type (List) - and is not appropriate. Next, you are trying to create a generic class List as the main class of your program ... and in the System.Collections. Generic namespace no less.
Well, this will conflict with the existing . NET List class - so you will get errors from that as well. What you really want to do here is create a namespace that is associated with (or describes) the program you are writing.
Don't try to re-use the existing . NET framework namepsaces for that purpose. And don't name your class List.
Finally, your class is not really a generic class ... the type parameter T is not used for any purpose in the program code. And your class is not an implementation of a list ... it's a ListProcessor (or something along those lines). You should be careful when naming classes or interfaces in a program so that they have a strong relationship to what they are named.It's also a good idea (when possible) to avoid creating names that collide with those already used by common classes in the .
NET framework - as that can cause ambiguity and confusion in your code.
1 Great advice! All I really said was that redeclaring existing namespaces/classes is illegal... – BoltClock Jan 25 at 19:35 Yeah, I was changing some stuff around to reflect stuff that I was reading on MSDN, which I now realize has nothing to do with my issue. This is advice is sound though so it is much appreciated.
– Cistoran Jan 25 at 19:39.
Remove: using System.Collections.Generic. List; List is contained in the Generic namespace which you are already "using".
You only need to import the namespace. So remove the offending line. Other than that, you have declared your program class to be generic List.
You don't need that, your entry point should just be in a normal static class.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.