示例#1
0
        protected virtual IStringSetter GetSetterFor(Type type)
        {
#if !PCL
            return(DynamicPropertyCache.GetOrAdd(
                       type,
                       t => DynamicPropertyFactory.PropertyFor(GetPropertyFor(type))).Setter);
#else
            if (DynamicPropertyCache.ContainsKey(type))
            {
                return(DynamicPropertyCache[type].Setter);
            }

            lock (DynamicPropertyCache)
            {
                if (DynamicPropertyCache.ContainsKey(type))
                {
                    return(DynamicPropertyCache[type].Setter);
                }

                var r = DynamicPropertyFactory.PropertyFor(GetPropertyFor(type));
                DynamicPropertyCache.Add(type, r);

                return(r.Setter);
            }
#endif
        }
示例#2
0
        public virtual string GetPropertyNameFor(Type type)
        {
#if !PCL
            return(DynamicPropertyCache.GetOrAdd(
                       type,
                       t => DynamicPropertyFactory.PropertyFor(GetPropertyFor(type))).Name);
#else
            if (DynamicPropertyCache.ContainsKey(type))
            {
                return(DynamicPropertyCache[type].Name);
            }

            lock (DynamicPropertyCache)
            {
                if (DynamicPropertyCache.ContainsKey(type))
                {
                    return(DynamicPropertyCache[type].Name);
                }

                var r = DynamicPropertyFactory.PropertyFor(GetPropertyFor(type));
                DynamicPropertyCache.Add(type, r);

                return(r.Name);
            }
#endif
        }
示例#3
0
 public virtual string GetPropertyNameFor(Type type)
 {
     return(DynamicPropertyCache.GetOrAdd(
                type,
                t => DynamicPropertyFactory.PropertyFor(GetPropertyFor(type))).Name);
 }
示例#4
0
 protected virtual IStringSetter GetSetterFor(Type type)
 {
     return(DynamicPropertyCache.GetOrAdd(
                type,
                t => DynamicPropertyFactory.PropertyFor(GetPropertyFor(type))).Setter);
 }