public int getValue(PropertiesName theProp) { if (mProp.ContainsPropName(theProp)) { return(mProp.returnPropValue(theProp)); } return(0); }
public void setValue(PropertiesName theProp, int theValue) { foreach (PropertiesFoo prop in mProp) { if (prop.propName == theProp) { prop.prop.mValue = theValue; } } }
public static Property returnProperty(this IList <PropertiesFoo> thisList, PropertiesName thePropName) { foreach (PropertiesFoo property in thisList) { if (property.propName == thePropName) { return(property.prop); } } return(null); }
public static int returnPropValue(this IList <PropertiesFoo> thisList, PropertiesName thePropName) { foreach (PropertiesFoo property in thisList) { if (property.propName == thePropName) { return(property.prop.mValue); } } return(0); }
public static bool ContainsPropName(this IList <PropertiesFoo> thisList, PropertiesName thePropName) { foreach (PropertiesFoo property in thisList) { if (property.propName == thePropName) { return(true); } } return(false); }
private void Initialize() { // get properties List <PropertyInfo> props = GetSerializableProperties(Type); PropertiesCount = props.Count; for (int i = 0; i < props.Count; i++) { PropertyInfo prop = props[i]; Func <object, object> getter = SerializerUtils.PropertyGetterToDelegate(prop.GetMethod); Action <object, object> setter = SerializerUtils.PropertySetterToDelegate(prop.SetMethod); ISerializerInternal serializer = SerializerDependencies.SerializerCollection.GetOrAdd(prop.PropertyType); PropertieGetter.Add(getter); PropertieSetter.Add(setter); Serializers.Add(serializer); PropertiesName.Add(prop.Name); } // get fields List <FieldInfo> fields = GetSerializableFields(Type); var FieldsCount = fields.Count; PropertiesCount += FieldsCount; for (int i = 0; i < fields.Count; i++) { FieldInfo field = fields[i]; Func <object, object> getter = SerializerUtils.FieldGetterToDelegate(field); Action <object, object> setter = SerializerUtils.FieldSetterToDelegate(field); ISerializerInternal serializer = SerializerDependencies.SerializerCollection.GetOrAdd(field.FieldType); PropertieGetter.Add(getter); PropertieSetter.Add(setter); Serializers.Add(serializer); PropertiesName.Add(field.Name); } }
public void addValue(PropertiesName theProp, int theValue) { setValue(theProp, getValue(theProp) + theValue); }