DataConnectionProperties.ReadValueFromString 方法
命名空間: 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
類型:String要從中讀取值的屬性名稱。
connectionString
類型:String值應該閱讀的連接字串。
index
類型:Int32%索引的連接字串中開始讀取的值。
傳回值
類型:Object
傳回表示輸入範圍的 connectionString 參數中的子字串屬性值開始索引和屬性名稱的尾端,轉換為正確的型別。
例外狀況
例外狀況 | 條件 |
---|---|
ArgumentNullException | name 和 connectionString 參數為 null。 |
FormatException | 連接字串的格式無效。 |
InvalidCastException | 讀取的字串值不能轉換為屬性型別 (Property Type)。 |
備註
Parse 方法的基底實作會呼叫這個方法,以剖析輸入連接字串。 它會使用 index 追蹤參數字串的目前位置並依賴這個方法和方法 ReadNameFromString 適當地更新索引。
基底實作會執行下列動作:
它會識別在引號未包含在引號中,或是包在單引號或雙引號括住的值;
然後它會讀取直到在任何類型不會封入引號屬性項目分隔字元的第一個符合項目,
然後不逸出任何內嵌引號字元;而且
最後,它會嘗試將字串值轉換成正確型別傳遞至以擷取指定的屬性描述項和使用它的 TypeConverter 轉換為正確的型別。
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。