박하의 나날

Dictionary<TKey, TValue>.ContainsKey메소드

프로그래밍/Unity

Dictionary<TKey, TValue>.ContainsKey메소드

2016.10.19. 17:31

 

[c#]
public bool ContainsKey(
  TKey key
)
 
[c++]
public:
virtual bool ContainsKey(
  TKey key
)
cs

Dictionary<Tkey, TValue>에서 특정키가 있는지 여부를 확인한 결과를 반환한다.
지정된 키가 있으면 true, 아니면 false. 

public class DictionaryEx{
    public static void Main(){
        IDictionary<string, string> openWith = new IDictionary<string, string>();
        if (!openWith.ContainsKey("ht"))
        {
            openWith.Add("ht", "hypertrm.exe");
            Console.WriteLine("Value added for key = \"ht\": {0}", 
                openWith["ht"]);
        }
    }
}
cs

 

'프로그래밍 > Unity' 카테고리의 다른 글

2016.11.18. 22:05  (0) 2017.04.09
2016.10.27. 19:59~  (0) 2017.04.09
String  (0) 2017.04.09
IEnumerable, IEnumerator  (0) 2017.04.09
ArrayList  (0) 2017.04.09