P Peter Larsen Jan 30, 2006 #1 Hi, How do i type cast a type to an array of type, e.g. IntPtr to IntPtr[] ?? /Peter
P Peter Rilling Jan 30, 2006 #2 You cannot simply turn a int into an array of ints, they are different types. You can add an int to an array of ints. int[] manyInts = new int[] {myInt1, myInt2};
You cannot simply turn a int into an array of ints, they are different types. You can add an int to an array of ints. int[] manyInts = new int[] {myInt1, myInt2};
P Peter Larsen Jan 31, 2006 #3 Ok, i think i have to explain this a little bit better IntPtr poins to an array of structs, chars, floats or other types. E.g. in some languages, if you have a property s of the type string, you can simply turn s into an array of chars, s[0]. Or in C++ you can do something like this: struct MyStruct int count; int i[1]; } MyStruct ms = (MyStruct)myProperty. ms->i[count-1] etc.etc. /Peter Peter Rilling said: You cannot simply turn a int into an array of ints, they are different types. You can add an int to an array of ints. int[] manyInts = new int[] {myInt1, myInt2}; Peter Larsen said: Hi, How do i type cast a type to an array of type, e.g. IntPtr to IntPtr[] ?? /Peter Click to expand... Click to expand...
Ok, i think i have to explain this a little bit better IntPtr poins to an array of structs, chars, floats or other types. E.g. in some languages, if you have a property s of the type string, you can simply turn s into an array of chars, s[0]. Or in C++ you can do something like this: struct MyStruct int count; int i[1]; } MyStruct ms = (MyStruct)myProperty. ms->i[count-1] etc.etc. /Peter Peter Rilling said: You cannot simply turn a int into an array of ints, they are different types. You can add an int to an array of ints. int[] manyInts = new int[] {myInt1, myInt2}; Peter Larsen said: Hi, How do i type cast a type to an array of type, e.g. IntPtr to IntPtr[] ?? /Peter Click to expand... Click to expand...