SecureString.SecureString(Char*, Int32) Constructor

Initializes a new instance of the SecureString class from a subarray of System.Char objects.

This constructor is not CLS-compliant.   The CLS-compliant alternative is SecureString.

Namespace: System.Security
Assembly: mscorlib (in mscorlib.dll)

public SecureString (
	char* value,
	int length
Not applicable.



A pointer to an array of System.Char objects.


The number of elements of value to include in the new instance.

Exception typeCondition


value is a null reference (Nothing in Visual Basic).


length is less than zero or greater than 65536.


An error occurred while encrypting or decrypting the value of this secure string.


This operation is not supported on this platform.

This constructor initializes the new SecureString object to the number of characters in value specified by length; the value of the instance is then encrypted.

Windows 2000 Platform Note: SecureString is only supported on Windows 2000 Service Pack 3 and later.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions