String array in constructor
- From: mattias.k.nyberg@xxxxxxxxx
- Date: 31 May 2006 06:32:23 -0700
So Im trying to learn to program with C#. And I have this question
about why the string array won't work in the first class but it does in
the second. To me it looks like they do the exact same thing.
class Test
{
string[] words;
public Test() {
words = { "", "", "" }; // This doesn't work
}
}
class Test2
{
string[] words;
public Test2() {
words = new string[3]; // This works
}
}
.
- Follow-Ups:
- Re: String array in constructor
- From: Brian Gideon
- Re: String array in constructor
- From: Keunho Yoo
- Re: String array in constructor
- From: Keunho Yoo
- Re: String array in constructor
- From: Keunho Yoo
- Re: String array in constructor
- Prev by Date: Phone number regular expressions
- Next by Date: Re: Interop, Late Binding and Array of longs
- Previous by thread: Phone number regular expressions
- Next by thread: Re: String array in constructor
- Index(es):
Relevant Pages
|