From: Rick on
How do I create an array like the following which contains string and integer?

string[,] siblings = { {"Mike", 28}, {"Mary", 25}, {"John", 31} };



From: Jason Newell on
object[,] siblings = { { "Mike", 28 }, { "Mary", 25 }, { "John", 31 } };

Jason Newell
www.jasonnewell.net

Rick wrote:
> How do I create an array like the following which contains string and integer?
>
> string[,] siblings = { {"Mike", 28}, {"Mary", 25}, {"John", 31} };
>
>
>
From: Rick on
thanks

"Jason Newell" wrote:

> object[,] siblings = { { "Mike", 28 }, { "Mary", 25 }, { "John", 31 } };
>
> Jason Newell
> www.jasonnewell.net
>
> Rick wrote:
> > How do I create an array like the following which contains string and integer?
> >
> > string[,] siblings = { {"Mike", 28}, {"Mary", 25}, {"John", 31} };
> >
> >
> >
> .
>
From: Arne Vajhøj on
On 14-05-2010 16:34, Rick wrote:
> How do I create an array like the following which contains string and integer?
>
> string[,] siblings = { {"Mike", 28}, {"Mary", 25}, {"John", 31} };

Jason already showed you how to use object[,].

And it works.

But I will strongly recommend that you use X[] where X is
a class with a string and an int property instead. It is
a lot more type safe.

Arne
From: Rick on
Arnie,
Could you please provide me a sample code?

"Arne Vajhøj" wrote:

> On 14-05-2010 16:34, Rick wrote:
> > How do I create an array like the following which contains string and integer?
> >
> > string[,] siblings = { {"Mike", 28}, {"Mary", 25}, {"John", 31} };
>
> Jason already showed you how to use object[,].
>
> And it works.
>
> But I will strongly recommend that you use X[] where X is
> a class with a string and an int property instead. It is
> a lot more type safe.
>
> Arne
> .
>
 |  Next  |  Last
Pages: 1 2
Prev: When to use ThreadPool
Next: using the ThreadPool