Beispiel #1
0
 Type TypeFromEnum(TypeEnumeration enumeration)
 {
     foreach (KeyValuePair <Type, TypeEnumeration> kvp in mTypeToEnumerationDictionary)
     {
         if (kvp.Value == enumeration)
         {
             return(kvp.Key);
         }
     }
     return(null);
 }
Beispiel #2
0
        private Type GetTypeToCastTo(object left, object right)
        {
            Type leftType  = left.GetType();
            Type rightType = right.GetType();

            int max = System.Math.Max(
                (int)mTypeToEnumerationDictionary[leftType],
                (int)mTypeToEnumerationDictionary[rightType]);

            TypeEnumeration maxEnumeration = (TypeEnumeration)max;

            Type typeToCastTo = TypeFromEnum(maxEnumeration);

            return(typeToCastTo);
        }
        Type TypeFromEnum(TypeEnumeration enumeration)
        {
            foreach (KeyValuePair<Type, TypeEnumeration> kvp in mTypeToEnumerationDictionary)
            {
                if (kvp.Value == enumeration)
                {
                    return kvp.Key;
                }
            }
            return null;

        }