/// <summary> /// returns a list of object properties that have been flaged by a specific Attribute /// </summary> /// <param name="intendedType"></param> /// <param name="mode"></param> /// <returns></returns> public static List <PropertyInfo> GetCommunicationFlaggedProperties(Type intendedType, ConversionMode mode, Type targetType = null) { if (CachePropertyInfos == null) { CachePropertyInfos = new Dictionary <string, List <PropertyInfo> >(); } var key = intendedType.ToString() + (targetType == null ? "" : targetType.ToString()) + mode.ToString(); if (CachePropertyInfos.Keys.Contains(key)) { return(CachePropertyInfos[key]); } if (targetType == null) { var result = (from x in intendedType.GetProperties() let y = (from z in x.GetCustomAttributes(typeof(IComExclusion), true) where ((IComExclusion)z).Mode == mode select z).Count() where y == 0 select x).ToList(); CachePropertyInfos.Add(key, result); return(result); } else { var result = (from x in intendedType.GetProperties() join c in targetType.GetProperties() on x.Name equals c.Name let y = (from z in x.GetCustomAttributes(typeof(IComExclusion), true) where ((IComExclusion)z).Mode == mode select z).Count() let y1 = (from z1 in c.GetCustomAttributes(typeof(IComExclusion), true) where ((IComExclusion)z1).Mode == mode select z1).Count() where y == 0 && y1 == 0 select x).ToList(); CachePropertyInfos.Add(key, result); return(result); } }
public static string MakeParameter(ConversionMode mode) { return(", ConversionMode::" + mode.ToString()); }
public static string MakeParameter(ConversionMode mode) { return ", ConversionMode::" + mode.ToString(); }