一、字典Dictionaries介紹
Dictionary里面的每一個元素都是一個鍵值對(由二個元素組成:鍵和值);鍵必須是唯一的,而值不需要唯一的;鍵和值都可以是任何類型(比如:string, int32,Net類型);
Dictionary它的命名空間是System.Collection.Generic。
二、字典Dictionaries屬性
Comparer: 獲取用於確定字典中的鍵是否相等的 IEqualityComparer<T>;
Count: 獲取包含在 Dictionary<TKey, TValue> 中的鍵/值對的數目;
Item: 獲取或設置與指定的鍵相關聯的值;
Keys: 獲取包含 Dictionary<TKey, TValue> 中的鍵的集合;
Values: 獲取包含 Dictionary<TKey, TValue> 中的值的集合。
三、字典Dictionaries方法
Add(TKey, TValue):將指定的鍵和值添加到字典中字典變量.Add(“111”, “Val”);
Clear: 從 Dictionary<TKey, TValue> 中移除所有的鍵和值
字典變量. Clear ();
ContainsKey: 確定 Dictionary<TKey, TValue> 是否包含指定的鍵
字典變量. ContainsKey(“111”);
ContainsValue: 確定 Dictionary<TKey, TValue> 是否包含特定值
字典變量. ContainsValue (“111”);
Equals(Object):確定指定的 Object 是否等於當前的 Object
字典變量. Equals (字典變量);
Remove: 從 Dictionary<TKey, TValue> 中移除所指定的鍵的值
字典變量. Equals (字典變量);
ToString: 返回表示當前對象的字符串
字典變量. ToString().
四、構造函數
構造函數:New Dictionary(of TKey, TValue)from{{ TKey 1, TValue 1},{ TKey 2, TValue 2}}如: New Dictionary(of string,string)from{{"111","val1"},{"222","Val2"}}
UiPath技術交流群:
「465630324」
文章來源:RPA之家(http://www.rpazj.com)
作者:RPA之家團隊
