在属性名称后,读取开始在指定的索引的连接字符串的属性,将其转换为正确的类型,并更新索引指向位置。
命名空间: Microsoft.VisualStudio.Data
程序集: Microsoft.VisualStudio.Data(在 Microsoft.VisualStudio.Data.dll 中)
语法
声明
Protected Overridable Function ReadValueFromString ( _
propertyName As String, _
connectionString As String, _
ByRef index As Integer _
) As Object
protected virtual Object ReadValueFromString(
string propertyName,
string connectionString,
ref int index
)
protected:
virtual Object^ ReadValueFromString(
String^ propertyName,
String^ connectionString,
int% index
)
abstract ReadValueFromString :
propertyName:string *
connectionString:string *
index:int byref -> Object
override ReadValueFromString :
propertyName:string *
connectionString:string *
index:int byref -> Object
protected function ReadValueFromString(
propertyName : String,
connectionString : String,
index : int
) : Object
参数
- propertyName
类型:System.String
值读取属性的名称。
- connectionString
类型:System.String
该值应读取连接字符串。
- index
类型:System.Int32%
索引到的连接字符串中开始读取值。
返回值
类型:System.Object
返回表示在输入范围的 connectionString 参数的子字符串属性值开始索引和属性名称的末尾,会转换为正确的类型。
异常
异常 | 条件 |
---|---|
ArgumentNullException | name 和 connectionString 参数为null。 |
FormatException | 连接字符串的格式无效。 |
InvalidCastException | 读取的字符串值无法转换为属性类型。 |
备注
Parse 方法的基实现调用此方法,在分析输入连接字符串。它使用 index 参数跟踪该字符串的当前位置和依赖此方法和 ReadNameFromString 方法相应地更新索引。
基实现执行以下操作:
它标识不在引号内,或者在单引号或双引号括起来的值;
然后读取直到在任何不括在引号属性项分隔符的第一个匹配项;
然后unescapes任何嵌入的引号字符;和
最后,它尝试将字符串值转换为正确的类型通过检索所指定的属性的类型描述符并使用其 TypeConverter 转换为正确的类型。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关更多信息,请参见通过部分受信任的代码使用库。