private T GetLanguageDependentProperty <T>(RedDotAttribute attribute, PropertyInfo property) { try { var contentType = typeof(T).GetGenericArguments()[0]; var realType = typeof(LanguageDependentValue <>).MakeGenericType(contentType); var constructor = realType.GetConstructor(new[] { typeof(IPartialRedDotProjectObject), typeof(RedDotAttribute) }); // ReSharper disable PossibleNullReferenceException return((T)constructor.Invoke(new object[] { this, attribute })); // ReSharper restore PossibleNullReferenceException } catch (Exception e) { throw new SmartAPIInternalException( string.Format("Internal error in construction of language dependent property {0}", property.Name), e); } }
public LanguageDependentValue(IPartialRedDotProjectObject parent, RedDotAttribute attribute) { _parent = parent; _attribute = attribute; }