Its description says: Initializes a new instance of the String class to the value indicated by a specified pointer to an array of Unicode characters.
However, I got error, when I tried following code to initialize string using pointer to an array of characters:
char[] cArray = {'a','r','r','a','y'};char[]* cArray_ptr = &cArray;string s = new string(cArray_ptr); // Error: cannot convert char[]* to char*
char[] cArray = {'a','r','r','a','y'};char[]* cArray_ptr = &cArray;string s = new string(cArray_ptr); // Error: cannot convert char[]* to char*
So, my question is: 1. Is
String(Char*)
String(Char*)
takes character pointer as argument instead of character array pointer? 2. Or am I doing some mistake in declaring and initializing character array pointer?