public static VgXmlPropertyContext CreateContext(PropertyInfo property) { if (_softCache.TryGetValue(property, out var weakReference) && weakReference.TryGetTarget(out var cachedProperty)) { return(cachedProperty); } var context = new VgXmlPropertyContext(property); if (_softCache.ContainsKey(property)) { _softCache[property].SetTarget(context); } else { _softCache[property] = new WeakReference <VgXmlPropertyContext>(context); } return(context); }
private static IEnumerable <VgXmlPropertyContext> CreatePropertyContexts(Type type) { return(from p in type.GetProperties() where p.GetCustomAttribute <VgXmlEntityAttribute>() != null select VgXmlPropertyContext.CreateContext(p)); }