aspxtreme

String Constructor ( Char*, Int32, Int32 )

System Namespace   String Class


Initializes a new instance of the String class to the value indicated by a specified pointer to an array of Unicode characters, a starting character position within that array, and a length.

This constructor is not CLS-compliant. For more information about CLS compliance, see What is the Common Language Specification.

[ C# ]
[ Serializable ]
unsafe public String (
   char* value,
   int startIndex,
   int length
);

[ C++ ]
[ Serializable ]
public: String (
   __wchar_t* value,
   int startIndex,
   int length
);

[ VB ] This constructor cannot be used in Visual Basic.

[ JScript ] This constructor cannot be used in JScript.

Parameters [ C#, C++ ]

value
A pointer to an array of Unicode characters.
startIndex
The starting position within value.
length
The number of characters within value to use.

Exceptions [ C#, C++ ]


Exception Type Condition
ArgumentOutOfRangeException startIndex or length is less than zero.

-or-

value is a null pointer and length is not zero.


Remarks [ C#, C++ ]

If length is zero, an Empty instance is initialized.

This constructor copies Unicode characters from value, starting at startIndex and ending at ( startIndex + length- 1 ).

If the specified range is outside of the memory allocated for the sequence of characters, the behavior of this constructor is system dependent. For example, such a situation might cause an access violation.

In C#, this constructor is defined only in the context of unmanaged code.

See Also

String Members   String Constructor Overload List   Char   Int32



Books and more ...


Suggested Reading

Need a break ?



Previous page Back to top Next page

Check out related books at Amazon

© 2000-2008 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support aspxtreme