Formats a property value for placement in a connection string.
Namespace: Microsoft.VisualStudio.Data
Assembly: Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)
Syntax
'宣言
Protected Overridable Function GetValueAsString ( _
propertyName As String _
) As String
'使用
Dim propertyName As String
Dim returnValue As String
returnValue = Me.GetValueAsString(propertyName)
protected virtual string GetValueAsString(
string propertyName
)
protected:
virtual String^ GetValueAsString(
String^ propertyName
)
protected function GetValueAsString(
propertyName : String
) : String
Parameters
propertyName
Type: System.StringThe name of a property to be formatted.
Return Value
Type: System.String
Returns the value of the specified property in a string format suitable for placement in a connection string.
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | The name parameter is null. |
| InvalidOperationException | The property does not exist. |
Remarks
This method is called by the base implementation of ToDisplayString and ToFullString when formatting property values to be placed in the output string.
The base implementation of this method gets the PropertyDescriptor for the property and uses its TypeConverter to produce a string representation, then it applies the following formatting rules:
If the property value is an Enum type that is marked with the FlagsAttribute, replace every comma (",") with a pipe ("|");
If the property value contains one or more single quotes ('), change each to two single quotation marks ('');
If the name/value separator or property entry separators (as specified in the constructor) contains one or more double quotes("), equal signs (=), or semicolons (;), then enclose the entire value in single quotation marks (').
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
DataConnectionProperties Class