ICodeGenerator::CreateValidIdentifier Method (String^)

 

Creates a valid identifier for the specified value.

Namespace:   System.CodeDom.Compiler
Assembly:  System (in System.dll)

[PermissionSetAttribute(SecurityAction::LinkDemand, Name = "FullTrust")]
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Name = "FullTrust")]
String^ CreateValidIdentifier(
	String^ value
)

Parameters

value
Type: System::String^

The string to generate a valid identifier for.

Return Value

Type: System::String^

A valid identifier for the specified value.

CreateValidIdentifier tests whether the identifier conflicts with reserved or language keywords, and returns a valid identifier name that does not conflict. The returned identifier will contain the same value but, if it conflicts with reserved or language keywords, will have escape code formatting added to differentiate the identifier from the keyword. Typically, if the value needs modification, value is returned preceded by an underscore "_".

SecurityAction::LinkDemand

for full trust for the immediate caller. This member cannot be used by partially trusted code.

SecurityAction::InheritanceDemand

for full trust for inheritors. This member cannot be inherited by partially trusted code.

.NET Framework
Available since 1.1
Return to top
Show: