mscorlib(4.0.0.0) API with additions
|
Encodes and decodes XML names, and provides methods for converting between common language runtime types and XML Schema definition language (XSD) types. When converting data types, the values returned are locale-independent. More...
Static Public Member Functions | |
static string | EncodeName (string name) |
Converts the name to a valid XML name. More... | |
static string | EncodeNmToken (string name) |
Verifies the name is valid according to the XML specification. More... | |
static string | EncodeLocalName (string name) |
Converts the name to a valid XML local name. More... | |
static string | DecodeName (string name) |
Decodes a name. This method does the reverse of the M:System.Xml.XmlConvert.EncodeName(System.String) and M:System.Xml.XmlConvert.EncodeLocalName(System.String) methods. More... | |
static string | VerifyName (string name) |
Verifies that the name is a valid name according to the W3C Extended Markup Language recommendation. More... | |
static string | VerifyNCName (string name) |
Verifies that the name is a valid NCName according to the W3C Extended Markup Language recommendation. An NCName is a name that cannot contain a colon. More... | |
static string | VerifyTOKEN (string token) |
Verifies that the string is a valid token according to the W3C XML Schema Part2: Datatypes recommendation. More... | |
static string | VerifyNMTOKEN (string name) |
Verifies that the string is a valid NMTOKEN according to the W3C XML Schema Part2: Datatypes recommendation More... | |
static string | VerifyXmlChars (string content) |
Returns the passed-in string if all the characters and surrogate pair characters in the string argument are valid XML characters, otherwise an XmlException is thrown with information on the first invalid character encountered. More... | |
static string | VerifyPublicId (string publicId) |
Returns the passed in string instance if all the characters in the string argument are valid public id characters. More... | |
static string | VerifyWhitespace (string content) |
Returns the passed-in string instance if all the characters in the string argument are valid whitespace characters. More... | |
static unsafe bool | IsStartNCNameChar (char ch) |
Checks if the passed-in character is a valid Start Name Character type. More... | |
static unsafe bool | IsNCNameChar (char ch) |
Checks whether the passed-in character is a valid non-colon character type. More... | |
static unsafe bool | IsXmlChar (char ch) |
Checks if the passed-in character is a valid XML character. More... | |
static bool | IsXmlSurrogatePair (char lowChar, char highChar) |
Checks if the passed-in surrogate pair of characters is a valid XML character. More... | |
static bool | IsPublicIdChar (char ch) |
Returns the passed-in character instance if the character in the argument is a valid public id character, otherwise null . More... | |
static unsafe bool | IsWhitespaceChar (char ch) |
Checks if the passed-in character is a valid XML whitespace character. More... | |
static string | ToString (bool value) |
Converts the T:System.Boolean to a T:System.String. More... | |
static string | ToString (char value) |
Converts the T:System.Char to a T:System.String. More... | |
static string | ToString (decimal value) |
Converts the T:System.Decimal to a T:System.String. More... | |
static string | ToString (sbyte value) |
Converts the T:System.SByte to a T:System.String. More... | |
static string | ToString (short value) |
Converts the T:System.Int16 to a T:System.String. More... | |
static string | ToString (int value) |
Converts the T:System.Int32 to a T:System.String. More... | |
static string | ToString (long value) |
Converts the T:System.Int64 to a T:System.String. More... | |
static string | ToString (byte value) |
Converts the T:System.Byte to a T:System.String. More... | |
static string | ToString (ushort value) |
Converts the T:System.UInt16 to a T:System.String. More... | |
static string | ToString (uint value) |
Converts the T:System.UInt32 to a T:System.String. More... | |
static string | ToString (ulong value) |
Converts the T:System.UInt64 to a T:System.String. More... | |
static string | ToString (float value) |
Converts the T:System.Single to a T:System.String. More... | |
static string | ToString (double value) |
Converts the T:System.Double to a T:System.String. More... | |
static string | ToString (TimeSpan value) |
Converts the T:System.TimeSpan to a T:System.String. More... | |
static string | ToString (DateTime value) |
Converts the T:System.DateTime to a T:System.String. More... | |
static string | ToString (DateTime value, string format) |
Converts the T:System.DateTime to a T:System.String. More... | |
static string | ToString (DateTime value, XmlDateTimeSerializationMode dateTimeOption) |
Converts the T:System.DateTime to a T:System.String using the T:System.Xml.XmlDateTimeSerializationMode specified. More... | |
static string | ToString (DateTimeOffset value) |
Converts the supplied T:System.DateTimeOffset to a T:System.String. More... | |
static string | ToString (DateTimeOffset value, string format) |
Converts the supplied T:System.DateTimeOffset to a T:System.String in the specified format. More... | |
static string | ToString (Guid value) |
Converts the T:System.Guid to a T:System.String. More... | |
static bool | ToBoolean (string s) |
Converts the T:System.String to a T:System.Boolean equivalent. More... | |
static char | ToChar (string s) |
Converts the T:System.String to a T:System.Char equivalent. More... | |
static decimal | ToDecimal (string s) |
Converts the T:System.String to a T:System.Decimal equivalent. More... | |
static sbyte | ToSByte (string s) |
Converts the T:System.String to a T:System.SByte equivalent. More... | |
static short | ToInt16 (string s) |
Converts the T:System.String to a T:System.Int16 equivalent. More... | |
static int | ToInt32 (string s) |
Converts the T:System.String to a T:System.Int32 equivalent. More... | |
static long | ToInt64 (string s) |
Converts the T:System.String to a T:System.Int64 equivalent. More... | |
static byte | ToByte (string s) |
Converts the T:System.String to a T:System.Byte equivalent. More... | |
static ushort | ToUInt16 (string s) |
Converts the T:System.String to a T:System.UInt16 equivalent. More... | |
static uint | ToUInt32 (string s) |
Converts the T:System.String to a T:System.UInt32 equivalent. More... | |
static ulong | ToUInt64 (string s) |
Converts the T:System.String to a T:System.UInt64 equivalent. More... | |
static float | ToSingle (string s) |
Converts the T:System.String to a T:System.Single equivalent. More... | |
static double | ToDouble (string s) |
Converts the T:System.String to a T:System.Double equivalent. More... | |
static TimeSpan | ToTimeSpan (string s) |
Converts the T:System.String to a T:System.TimeSpan equivalent. More... | |
static DateTime | ToDateTime (string s) |
Converts the T:System.String to a T:System.DateTime equivalent. More... | |
static DateTime | ToDateTime (string s, string format) |
Converts the T:System.String to a T:System.DateTime equivalent. More... | |
static DateTime | ToDateTime (string s, string[] formats) |
Converts the T:System.String to a T:System.DateTime equivalent. More... | |
static DateTime | ToDateTime (string s, XmlDateTimeSerializationMode dateTimeOption) |
Converts the T:System.String to a T:System.DateTime using the T:System.Xml.XmlDateTimeSerializationMode specified More... | |
static DateTimeOffset | ToDateTimeOffset (string s) |
Converts the supplied T:System.String to a T:System.DateTimeOffset equivalent. More... | |
static DateTimeOffset | ToDateTimeOffset (string s, string format) |
Converts the supplied T:System.String to a T:System.DateTimeOffset equivalent. More... | |
static DateTimeOffset | ToDateTimeOffset (string s, string[] formats) |
Converts the supplied T:System.String to a T:System.DateTimeOffset equivalent. More... | |
static Guid | ToGuid (string s) |
Converts the T:System.String to a T:System.Guid equivalent. More... | |
Encodes and decodes XML names, and provides methods for converting between common language runtime types and XML Schema definition language (XSD) types. When converting data types, the values returned are locale-independent.
Definition at line 11 of file XmlConvert.cs.
|
static |
Decodes a name. This method does the reverse of the M:System.Xml.XmlConvert.EncodeName(System.String) and M:System.Xml.XmlConvert.EncodeLocalName(System.String) methods.
name | The name to be transformed. |
Definition at line 81 of file XmlConvert.cs.
|
static |
Converts the name to a valid XML local name.
name | The name to be encoded. |
Definition at line 72 of file XmlConvert.cs.
|
static |
Converts the name to a valid XML name.
name | A name to be translated. |
Definition at line 54 of file XmlConvert.cs.
|
static |
Verifies the name is valid according to the XML specification.
name | The name to be encoded. |
Definition at line 63 of file XmlConvert.cs.
|
static |
Checks whether the passed-in character is a valid non-colon character type.
ch | The character to verify as a non-colon character. |
true
if the character is a valid non-colon character type; otherwise, false
.Definition at line 551 of file XmlConvert.cs.
|
static |
Returns the passed-in character instance if the character in the argument is a valid public id character, otherwise null
.
ch | T:System.Char object to validate. |
null
.Definition at line 583 of file XmlConvert.cs.
|
static |
Checks if the passed-in character is a valid Start Name Character type.
ch | The character to validate. |
true
if the character is a valid Start Name Character type; otherwise, false
. Definition at line 543 of file XmlConvert.cs.
|
static |
Checks if the passed-in character is a valid XML whitespace character.
ch | The character to validate. |
true
if the passed in character is a valid XML whitespace character; otherwise false
.Definition at line 592 of file XmlConvert.cs.
|
static |
Checks if the passed-in character is a valid XML character.
ch | The character to validate. |
true
if the passed in character is a valid XML character; otherwise false
.Definition at line 560 of file XmlConvert.cs.
|
static |
Checks if the passed-in surrogate pair of characters is a valid XML character.
lowChar | The surrogate character to validate. |
highChar | The surrogate character to validate. |
true
if the passed in surrogate pair of characters is a valid XML character; otherwise false
.Definition at line 570 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Boolean equivalent.
s | The string to convert. |
Boolean
value, that is, true
or false
.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s does not represent a Boolean value. |
Definition at line 837 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Byte equivalent.
s | The string to convert. |
Byte
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.Byte.MinValue or greater than F:System.Byte.MaxValue. |
Definition at line 1045 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Char equivalent.
s | The string containing a single character to convert. |
Char
representing the single character.T:System.ArgumentNullException | The value of the s parameter is null . |
T:System.FormatException | The s parameter contains more than one character. |
Definition at line 878 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.DateTime equivalent.
s | The string to convert. |
DateTime
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is an empty string or is not in the correct format. |
Definition at line 1386 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.DateTime equivalent.
s | The string to convert. |
format | The format structure to apply to the converted DateTime . Valid formats include "yyyy-MM-ddTHH:mm:sszzzzzz" and its subsets. The string is validated against this format. |
DateTime
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s or format is String.Empty -or- s does not contain a date and time that corresponds to format . |
Definition at line 1400 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.DateTime equivalent.
s | The string to convert. |
formats | An array containing the format structures to apply to the converted DateTime . Valid formats include "yyyy-MM-ddTHH:mm:sszzzzzz" and its subsets. |
DateTime
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s or an element of formats is String.Empty -or- s does not contain a date and time that corresponds to any of the elements of formats . |
Definition at line 1414 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.DateTime using the T:System.Xml.XmlDateTimeSerializationMode specified
s | The T:System.String value to convert. |
dateTimeOption | One of the T:System.Xml.XmlDateTimeSerializationMode values that specify whether the date should be converted to local time or preserved as Coordinated Universal Time (UTC), if it is a UTC date. |
T:System.NullReferenceException | s is null . |
T:System.ArgumentNullException | The dateTimeOption value is null . |
T:System.FormatException | s is an empty string or is not in a valid format. |
Definition at line 1429 of file XmlConvert.cs.
|
static |
Converts the supplied T:System.String to a T:System.DateTimeOffset equivalent.
s | The string to convert. Note   The string must conform to a subset of the W3C Recommendation for the XML dateTime type. For more information see http://www.w3.org/TR/xmlschema-2/#dateTime. |
T:System.ArgumentNullException | s is null . |
T:System.ArgumentOutOfRangeException | The argument passed to this method is outside the range of allowable values. For information about allowable values, see T:System.DateTimeOffset. |
T:System.FormatException | The argument passed to this method does not conform to a subset of the W3C Recommendations for the XML dateTime type. For more information see http://www.w3.org/TR/xmlschema-2/#dateTime. |
Definition at line 1461 of file XmlConvert.cs.
|
static |
Converts the supplied T:System.String to a T:System.DateTimeOffset equivalent.
s | The string to convert. |
format | The format from which s is converted. The format parameter can be any subset of the W3C Recommendation for the XML dateTime type. (For more information see http://www.w3.org/TR/xmlschema-2/#dateTime.) The string s is validated against this format. |
T:System.ArgumentNullException | s is null . |
T:System.FormatException | s or format is an empty string or is not in the specified format. |
Definition at line 1480 of file XmlConvert.cs.
|
static |
Converts the supplied T:System.String to a T:System.DateTimeOffset equivalent.
s | The string to convert. |
formats | An array of formats from which s can be converted. Each format in formats can be any subset of the W3C Recommendation for the XML dateTime type. (For more information see http://www.w3.org/TR/xmlschema-2/#dateTime.) The string s is validated against one of these formats. |
Definition at line 1494 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Decimal equivalent.
s | The string to convert. |
Decimal
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.Decimal.MinValue or greater than F:System.Decimal.MaxValue. |
Definition at line 910 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Double equivalent.
s | The string to convert. |
Double
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.Double.MinValue or greater than F:System.Double.MaxValue. |
Definition at line 1197 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Guid equivalent.
s | The string to convert. |
Guid
equivalent of the string.Definition at line 1507 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Int16 equivalent.
s | The string to convert. |
Int16
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.Int16.MinValue or greater than F:System.Int16.MaxValue. |
Definition at line 973 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Int32 equivalent.
s | The string to convert. |
Int32
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.Int32.MinValue or greater than F:System.Int32.MaxValue. |
Definition at line 997 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Int64 equivalent.
s | The string to convert. |
Int64
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.Int64.MinValue or greater than F:System.Int64.MaxValue. |
Definition at line 1021 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.SByte equivalent.
s | The string to convert. |
SByte
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.SByte.MinValue or greater than F:System.SByte.MaxValue. |
Definition at line 949 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.Single equivalent.
s | The string to convert. |
Single
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.Single.MinValue or greater than F:System.Single.MaxValue. |
Definition at line 1144 of file XmlConvert.cs.
|
static |
Converts the T:System.Boolean to a T:System.String.
value | The value to convert. |
Boolean
, that is, "true" or "false".Definition at line 601 of file XmlConvert.cs.
|
static |
Converts the T:System.Char to a T:System.String.
value | The value to convert. |
Char
.Definition at line 614 of file XmlConvert.cs.
|
static |
Converts the T:System.Decimal to a T:System.String.
value | The value to convert. |
Decimal
.Definition at line 623 of file XmlConvert.cs.
|
static |
Converts the T:System.SByte to a T:System.String.
value | The value to convert. |
SByte
.Definition at line 633 of file XmlConvert.cs.
|
static |
Converts the T:System.Int16 to a T:System.String.
value | The value to convert. |
Int16
.Definition at line 642 of file XmlConvert.cs.
|
static |
Converts the T:System.Int32 to a T:System.String.
value | The value to convert. |
Int32
.Definition at line 651 of file XmlConvert.cs.
|
static |
Converts the T:System.Int64 to a T:System.String.
value | The value to convert. |
Int64
.Definition at line 660 of file XmlConvert.cs.
|
static |
Converts the T:System.Byte to a T:System.String.
value | The value to convert. |
Byte
.Definition at line 669 of file XmlConvert.cs.
|
static |
Converts the T:System.UInt16 to a T:System.String.
value | The value to convert. |
UInt16
.Definition at line 679 of file XmlConvert.cs.
|
static |
Converts the T:System.UInt32 to a T:System.String.
value | The value to convert. |
UInt32
.Definition at line 689 of file XmlConvert.cs.
|
static |
Converts the T:System.UInt64 to a T:System.String.
value | The value to convert. |
UInt64
.Definition at line 699 of file XmlConvert.cs.
|
static |
Converts the T:System.Single to a T:System.String.
value | The value to convert. |
Single
.Definition at line 708 of file XmlConvert.cs.
|
static |
Converts the T:System.Double to a T:System.String.
value | The value to convert. |
Double
.Definition at line 729 of file XmlConvert.cs.
|
static |
Converts the T:System.TimeSpan to a T:System.String.
value | The value to convert. |
TimeSpan
.Definition at line 750 of file XmlConvert.cs.
|
static |
Converts the T:System.DateTime to a T:System.String.
value | The value to convert. |
DateTime
in the format yyyy-MM-ddTHH:mm:ss where 'T' is a constant literal.Definition at line 759 of file XmlConvert.cs.
|
static |
Converts the T:System.DateTime to a T:System.String.
value | The value to convert. |
format | The format structure that defines how to display the converted string. Valid formats include "yyyy-MM-ddTHH:mm:sszzzzzz" and its subsets. |
DateTime
in the specified format.Definition at line 768 of file XmlConvert.cs.
|
static |
Converts the T:System.DateTime to a T:System.String using the T:System.Xml.XmlDateTimeSerializationMode specified.
value | The T:System.DateTime value to convert. |
dateTimeOption | One of the T:System.Xml.XmlDateTimeSerializationMode values that specify how to treat the T:System.DateTime value. |
T:System.ArgumentException | The dateTimeOption value is not valid. |
T:System.ArgumentNullException | The value or dateTimeOption value is null . |
Definition at line 780 of file XmlConvert.cs.
|
static |
Converts the supplied T:System.DateTimeOffset to a T:System.String.
value | The T:System.DateTimeOffset to be converted. |
Definition at line 805 of file XmlConvert.cs.
|
static |
Converts the supplied T:System.DateTimeOffset to a T:System.String in the specified format.
value | The T:System.DateTimeOffset to be converted. |
format | The format to which s is converted. The format parameter can be any subset of the W3C Recommendation for the XML dateTime type. (For more information see http://www.w3.org/TR/xmlschema-2/#dateTime.) |
Definition at line 815 of file XmlConvert.cs.
|
static |
Converts the T:System.Guid to a T:System.String.
value | The value to convert. |
Guid
.Definition at line 824 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.TimeSpan equivalent.
s | The string to convert. The string format must conform to the W3C XML Schema Part 2: Datatypes recommendation for duration. |
TimeSpan
equivalent of the string.T:System.FormatException | s is not in correct format to represent a TimeSpan value. |
Definition at line 1318 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.UInt16 equivalent.
s | The string to convert. |
UInt16
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.UInt16.MinValue or greater than F:System.UInt16.MaxValue. |
Definition at line 1070 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.UInt32 equivalent.
s | The string to convert. |
UInt32
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.UInt32.MinValue or greater than F:System.UInt32.MaxValue. |
Definition at line 1095 of file XmlConvert.cs.
|
static |
Converts the T:System.String to a T:System.UInt64 equivalent.
s | The string to convert. |
UInt64
equivalent of the string.T:System.ArgumentNullException | s is null . |
T:System.FormatException | s is not in the correct format. |
T:System.OverflowException | s represents a number less than F:System.UInt64.MinValue or greater than F:System.UInt64.MaxValue. |
Definition at line 1120 of file XmlConvert.cs.
|
static |
Verifies that the name is a valid name according to the W3C Extended Markup Language recommendation.
name | The name to verify. |
T:System.Xml.XmlException | name is not a valid XML name. |
T:System.ArgumentNullException | name is null or String.Empty. |
Definition at line 301 of file XmlConvert.cs.
|
static |
Verifies that the name is a valid NCName
according to the W3C Extended Markup Language recommendation. An NCName
is a name that cannot contain a colon.
name | The name to verify. |
T:System.ArgumentNullException | name is null or String.Empty. |
T:System.Xml.XmlException | name is not a valid non-colon name. |
Definition at line 361 of file XmlConvert.cs.
|
static |
Verifies that the string is a valid NMTOKEN according to the W3C XML Schema Part2: Datatypes recommendation
name | The string you wish to verify. |
T:System.Xml.XmlException | The string is not a valid name token. |
T:System.ArgumentNullException | name is null . |
Definition at line 431 of file XmlConvert.cs.
|
static |
Returns the passed in string instance if all the characters in the string argument are valid public id characters.
publicId | T:System.String that contains the id to validate. |
Definition at line 506 of file XmlConvert.cs.
|
static |
Verifies that the string is a valid token according to the W3C XML Schema Part2: Datatypes recommendation.
token | The string value you wish to verify. |
T:System.Xml.XmlException | The string value is not a valid token. |
Definition at line 398 of file XmlConvert.cs.
|
static |
Returns the passed-in string instance if all the characters in the string argument are valid whitespace characters.
content | T:System.String to verify. |
null
.Definition at line 525 of file XmlConvert.cs.
|
static |
Returns the passed-in string if all the characters and surrogate pair characters in the string argument are valid XML characters, otherwise an XmlException
is thrown with information on the first invalid character encountered.
content | T:System.String that contains characters to verify. |
XmlException
is thrown with information on the first invalid character encountered.Definition at line 491 of file XmlConvert.cs.