ParameterizedString Class

 

Represents a string that has embedded parameters.

Namespace:   Microsoft.TeamFoundation.TestManagement.Client
Assembly:  Microsoft.TeamFoundation.TestManagement.Client (in Microsoft.TeamFoundation.TestManagement.Client.dll)

Inheritance Hierarchy

System.Object
  Microsoft.TeamFoundation.TestManagement.Client.ParameterizedString

Syntax

public class ParameterizedString : IEnumerable<ParameterizedStringPart>, 
    IEnumerable
public ref class ParameterizedString : IEnumerable<ParameterizedStringPart>, 
    IEnumerable
type ParameterizedString = 
    class
        interface IEnumerable<ParameterizedStringPart>
        interface IEnumerable
    end
Public Class ParameterizedString
    Implements IEnumerable(Of ParameterizedStringPart), IEnumerable

Constructors

Name Description
System_CAPS_pubmethod ParameterizedString()

Initializes a new instance of the ParameterizedString class.

System_CAPS_pubmethod ParameterizedString(IEnumerable<ParameterizedStringPart>)

Initializes a new instance of the ParameterizedString class by using the provided list of parameter parts.

System_CAPS_pubmethod ParameterizedString(String)

Initializes a new instance of the ParameterizedString class by using the given string.

System_CAPS_pubmethod ParameterizedString(XmlReader)

Initializes a new instance of the ParameterizedString class by using the provided XML reader.

Properties

Name Description
System_CAPS_pubproperty Count

Gets the number of parts in the string.

System_CAPS_pubpropertySystem_CAPS_static Empty

Gets an empty parameterized string.

System_CAPS_pubproperty FlowDocumentString

System_CAPS_pubproperty Item[Int32]

Gets the parameter part at the given index of the list of parts.

System_CAPS_pubproperty ParameterNames

Gets a read-only collection of parameter names from the list of parameter parts.

Methods

Name Description
System_CAPS_pubmethod Copy()

Returns a copy of this parameterized string.

System_CAPS_pubmethod Equals(Object)

Returns a value that indicates whether two objects are equal.(Overrides Object.Equals(Object).)

System_CAPS_pubmethod Equals(ParameterizedString)

Returns a value that indicates whether the provided parameterized string is equal to this parameterized string.

System_CAPS_protmethod Finalize()

(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_static FromFlowDocument(String)

System_CAPS_pubmethod FromXml(XmlReader)

Loads the parameters by using the provided XML reader.

System_CAPS_pubmethod GetEnumerator()

Returns an enumerator that iterates through the parameter parts collection of this parameterized string.

System_CAPS_pubmethod GetHashCode()

Returns the hash code for this instance.(Overrides Object.GetHashCode().)

System_CAPS_pubmethodSystem_CAPS_static GetParameterNamingErrorMessage()

Returns the localized message to be returned for an attempt to add a parameter part by using an invalid parameter name.

System_CAPS_pubmethod GetType()

(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_static IsValidParameterName(String)

Returns a value that indicates whether the provided name is a valid parameter name.

System_CAPS_protmethod MemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethod RenameParameter(String, String)

Renames the specified parameter by using the given new name and returns the changed parameterized string.

System_CAPS_pubmethod ReplaceParameter(String, String)

Replaces the specified parameter value by using the given replacement text.

System_CAPS_pubmethod ToPlainText()

System_CAPS_pubmethod ToString()

Returns this parameterized string object as a string.(Overrides Object.ToString().)

System_CAPS_pubmethod ToXml(XmlWriter)

Creates an XML representation of this parameterized string and saves it to the provided XML writer.

Fields

Name Description
System_CAPS_pubfieldSystem_CAPS_static ElementName

Contains the name of the element to use when this parameterized string object is saved to XML.

Operators

Name Description
System_CAPS_puboperatorSystem_CAPS_static Equality(ParameterizedString, ParameterizedString)

Returns the operator to use in code for equality (==).

System_CAPS_puboperatorSystem_CAPS_static Implicit(ParameterizedString to String)

Returns an operator that can be used for implicit comparison of parameterized strings.

System_CAPS_puboperatorSystem_CAPS_static Implicit(String to ParameterizedString)

Converts a string to a parameterized string.

System_CAPS_puboperatorSystem_CAPS_static Inequality(ParameterizedString, ParameterizedString)

Returns a value that indicates whether two objects are not equal.

Explicit Interface Implementations

Name Description
System_CAPS_pubinterfaceSystem_CAPS_privmethod IEnumerable.GetEnumerator()

Returns an enumerator that iterates through a collection.

Remarks

There are two ways to examine such a string... one is as a flat string with embedded parameters, another is as a list of strings and parameter references (names) Rule 1: There is no such thing as an illegal string the parsing rules are intentionally generous Here are some example string forms, together with what they will parse to "Put the @@object on the @@support" -> "Put the ", object, " on the ", support Escaping is optional, if the character following the @ is not a valid identifier lead character, or the string ends in an @ sign, the text is treated as a literal "An @ sign on its own may be OK" -> "An @ sign on its own may be OK" A parameter name must comply with C# identifier rules so for example when parsing a parameter, we stop after the first space: "Log in with @@domain @@user" -> "Log in with ", domain, " ", user If there is literal text immediately following a parameter name, then it may have to be separated "The plural of @@WORD is @@WORD@@s" -> "The plural of ", WORD, " is", WORD, "s" Juxtaposing two parameters without intervening space also requires the terminating @@ sign Enter the compound word @@prefix@@suffix -> "Enter the compound word ", prefix, suffix After the parameter, a ? indicates that the parameter value to be treated as if it were null (even it has been previously set) In a manual test context, this means that in the next example SessionId will always be requested and the new value will be used, even if it had an old value "Check the value of the @?SessionId" Case is not significant for parameters names, in the following string the parameter called "TESTVALUE" is used two times "Enter the test @@TESTVALUE @@testvalue

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

ParameterizedStringPart
Microsoft.TeamFoundation.TestManagement.Client Namespace

Return to top