CodeGeneration Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Contains utility methods for use in applications that generate PowerShell code.
public ref class CodeGeneration abstract sealed
public static class CodeGeneration
type CodeGeneration = class
Public Class CodeGeneration
- Inheritance
-
CodeGeneration
Methods
EscapeBlockCommentContent(String) |
Escapes content so that it is safe for inclusion in a block comment. For example: "<#" + EscapeBlockCommentContent(userContent) + "#>" |
EscapeFormatStringContent(String) |
Escapes content so that it is safe for inclusion in a string that will later be used as a format string. If this is to be embedded inside of a single-quoted string, be sure to also call EscapeSingleQuotedStringContent. For example: "'" + EscapeSingleQuotedStringContent(EscapeFormatStringContent(userContent)) + "'" -f $args. |
EscapeSingleQuotedStringContent(String) |
Escapes content so that it is safe for inclusion in a single-quoted string. For example: "'" + EscapeSingleQuotedStringContent(userContent) + "'" |
EscapeVariableName(String) |
Escapes content so that it is safe for inclusion in a string that will later be used in a variable name reference. This is only valid when used within PowerShell's curly brace naming syntax. For example: '${' + EscapeVariableName('value') + '}' |