次の方法で共有


SecurityElement.Escape メソッド

文字列内の無効な XML 文字を等価の有効な XML に置き換えます。

Public Shared Function Escape( _
   ByVal str As String _) As String
[C#]
public static string Escape(stringstr);
[C++]
public: static String* Escape(String* str);
[JScript]
public static function Escape(
   str : String) : String;

パラメータ

  • str
    エスケープする無効な文字を含む文字列。

戻り値

置き換えられた無効な文字を含む入力文字列。

解説

このメソッドを使用して、 SecurityElement 内の文字列を使用する前に、文字列内の無効な文字を置き換えます。エスケープ文字に置き換えずに無効な文字を SecurityElement で使用すると、 ArgumentException がスローされます。

無効な XML 文字とそれぞれと等価なエスケープ文字を次の表に示します。

無効な XML 文字 置き換える文字
"<" "&lt;"
">" "&gt;"
"\"" "&quot;"
"\'" "&apos;"
"&" "&amp;"

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

SecurityElement クラス | SecurityElement メンバ | System.Security 名前空間