Equalsobject public override bool equalsobject obj

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: pe = obj.GetType(); while (enumerator.MoveNext()) { propertyName = (string)enumerator.Current; type = ReflectionInfo.GetInstance(type).GetGetterType(propertyName); hasProperty = ReflectionInfo.GetInstance(type).HasWritableProperty(propertyName); } } else { hasProperty = ReflectionInfo.GetInstance(obj.GetType()).HasWritableProperty(propertyName); } } return hasProperty; } /// <summary> /// Checks to see if the Object have a property/field be a given name. /// </summary> /// <param name="obj">The Object on which to invoke the specified property.</param> /// <param name="propertyName">The name of the property to check for.</param> /// <returns> /// True or false if the property exists and is readable. /// </returns> public static bool HasReadableProperty(object obj, string propertyName) { bool hasProperty = false; if (obj is IDictionary) { hasProperty = ((IDictionary) obj).Contains(propertyName); } else { if (propertyName.IndexOf('.') > -1) { StringTokenizer parser = new StringTokenizer(propertyName, "."); IEnumerator enumerator = parser.GetEnumerator(); Type type = obj.GetType(); while (enumerator.MoveNext()) { propertyName = (string)enumerator.Current; type = ReflectionInfo.GetInstance(type).GetGetterType(propertyName); hasProperty = ReflectionInfo.GetInstance(type).HasReadableProperty(propertyName); } } else { hasProperty = ReflectionInfo.GetInstance(obj.GetType()).HasReadableProperty(propertyName); } } return hasProperty; } /// <summary> /// /// </summary> /// <param name="type"></param> /// <returns></returns> public static bool IsSimpleType(Type type) { if (_simpleTypeMap.Contains(type)) { return true; } else if (type.IsSubclassOf(typeof(ICollection))) { return true; } else if (type.IsSubclassOf(typeof(IDictionary))) { return true; } else if (type.IsSubclassOf(typeof(IList))) { return true; } else if (type.IsSubclassOf(typeof(IEnumerable))) { return true; } else { return false; } } /// <summary> /// Calculates a hash code for all readable properties of a object. /// </summary> /// <param name="obj">The objec...
View Full Document

This document was uploaded on 10/12/2012.

Ask a homework question - tutors are online