private List <ReactConstantInfo> InitConstantInfos() { var result = new List <ReactConstantInfo>(); foreach (var propertyInfo in ModuleType.GetProperties()) { var constantAttribute = propertyInfo.GetCustomAttribute <ReactConstantAttribute>(); if (constantAttribute != null) { var constantInfo = new ReactConstantInfo(propertyInfo, constantAttribute); result.Add(constantInfo); } } foreach (var fieldInfo in ModuleType.GetFields()) { var constantAttribute = fieldInfo.GetCustomAttribute <ReactConstantAttribute>(); if (constantAttribute != null) { var constantInfo = new ReactConstantInfo(fieldInfo, constantAttribute); result.Add(constantInfo); } } return(result); }
private List <ReactConstantInfo> InitConstantInfos() { var fieldConstants = from field in ModuleType.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static) let constantAttribute = field.GetCustomAttribute <ReactConstantAttribute>() where constantAttribute != null let constantInfo = new ReactConstantInfo(field, constantAttribute) select constantInfo; var propertyEvents = from property in ModuleType.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static) let constantAttribute = property.GetCustomAttribute <ReactConstantAttribute>() where constantAttribute != null let constantInfo = new ReactConstantInfo(property, constantAttribute) select constantInfo; return(fieldConstants.Concat(propertyEvents).ToList()); }
private List <ReactEventInfo> InitEventInfos() { var fieldEvents = from field in ModuleType.GetFields(BindingFlags.Public | BindingFlags.Instance) let eventAttribute = field.GetCustomAttribute <ReactEventAttribute>() where eventAttribute != null && !field.IsInitOnly select new ReactEventInfo(field, eventAttribute, EventEmitterName); var propertyEvents = from property in ModuleType.GetProperties(BindingFlags.Public | BindingFlags.Instance) let eventAttribute = property.GetCustomAttribute <ReactEventAttribute>() where eventAttribute != null let propertySetter = property.SetMethod where propertySetter != null && propertySetter.IsPublic select new ReactEventInfo(property, eventAttribute, EventEmitterName); return(fieldEvents.Concat(propertyEvents).ToList()); }