Convert a list element
-
You could call
Convert.ToInt32(listArray[0].ToString());
. Alternatively, if you're using .NET 2, I would recommend just creating the List asList<int> list = new List<int>();
Deja View - the feeling that you've seen this post before.
-
You could call
Convert.ToInt32(listArray[0].ToString());
. Alternatively, if you're using .NET 2, I would recommend just creating the List asList<int> list = new List<int>();
Deja View - the feeling that you've seen this post before.
Pete O`Hanlon wrote:
call Convert.ToInt32(listArray[0].ToString());
Is there any reason why you are calling
ToString()
? Convert works on object too... Only meaningful thing I can think of is to provideIFormatProvider
, but then again there isConvert.ToInt32 (Object, IFormatProvider)
overload.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
-
Pete O`Hanlon wrote:
call Convert.ToInt32(listArray[0].ToString());
Is there any reason why you are calling
ToString()
? Convert works on object too... Only meaningful thing I can think of is to provideIFormatProvider
, but then again there isConvert.ToInt32 (Object, IFormatProvider)
overload.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
dnh wrote:
Is there any reason why you are calling ToString()
Yup - typing in away from a dev box and doing it from memory - I don't tend to use the .NET 1 list anymore.:-D
Deja View - the feeling that you've seen this post before.
-
dnh wrote:
Is there any reason why you are calling ToString()
Yup - typing in away from a dev box and doing it from memory - I don't tend to use the .NET 1 list anymore.:-D
Deja View - the feeling that you've seen this post before.
:-D
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
-
You could call
Convert.ToInt32(listArray[0].ToString());
. Alternatively, if you're using .NET 2, I would recommend just creating the List asList<int> list = new List<int>();
Deja View - the feeling that you've seen this post before.
If the list is of
int
s to begin with, only a cast required.