Exemplo n.º 1
0
        bool ICollection <KeyValuePair <string, object> > .Remove(KeyValuePair <string, object> item)
        {
            if (string.IsNullOrEmpty(item.Key))
            {
                throw RuntimeFailure.CannotSpecifyNullKey("item");
            }

            object result;

            if (InnerMap.TryGetValue(item.Key, out result) && Equals(result, item.Value))
            {
                ClearProperty(item.Key);
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public override Type GetPropertyType(string property)
        {
            CheckProperty(property);

            // Must reimplement this to take advantage of parenting and to
            // check chaining modes
            object objValue;

            if (InnerMap.TryGetValue(property, out objValue))
            {
                if (objValue == null)
                {
                    return(typeof(object));
                }
                else
                {
                    return(objValue.GetType());
                }
            }

            return(null);
        }
Exemplo n.º 3
0
        protected override bool TryGetPropertyCore(string property, Type requiredType, out object value)
        {
            // Review the local storage to determine if it is contained
            requiredType = requiredType ?? typeof(object);
            if (InnerMap.TryGetValue(property, out value))
            {
                if (requiredType.GetTypeInfo().IsInstanceOfType(value) || value == null)
                {
                    return(true);
                }

                // Type coercion
                var str = value as string;
                if (str != null)
                {
                    value = Activation.FromText(requiredType, str, null, null);
                    return(true);
                }
            }

            value = null;
            return(base.TryGetPropertyCore(property, requiredType, out value));
        }
Exemplo n.º 4
0
 /// <summary>
 /// 해당 키의 값을 조회합니다. 있으면 true를 반환하고, 없으면 false를 반환합니다.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public bool TryGetValue(TKey key, out ICollection <TValue> value)
 {
     return(InnerMap.TryGetValue(key, out value));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 지정된 키와 연결된 값을 가져옵니다.
 /// </summary>
 /// <returns>
 /// <see cref="T:System.Collections.Generic.IDictionary`2"/>를 구현하는 개체에 지정한 키가 있는 요소가 포함되어 있으면 true이고, 그렇지 않으면 false입니다.
 /// </returns>
 /// <param name="key">가져올 값이 있는 키입니다.</param><param name="value">이 메서드가 반환될 때 지정된 키가 있으면 해당 키와 연결된 값이고, 그렇지 않으면 <paramref name="value"/> 매개 변수의 형식에 대한 기본값입니다.이 매개 변수는 초기화되지 않은 상태로 전달됩니다.</param><exception cref="T:System.ArgumentNullException"><paramref name="key"/>가 null인 경우</exception>
 public bool TryGetValue(TKey key, out ISet <TValue> value)
 {
     return(InnerMap.TryGetValue(key, out value));
 }