Esempio n. 1
0
 private static string GetChildsName(Human human)
 {
     var namingMethod = human.GetType().GetMethods()
         .First(x => x.Name == Human.ChildNamingMethod && x.ReturnType == typeof(string));
     try
     {
         return namingMethod.Invoke(human, null) as string;
     }
     catch (Exception e)
     {
         throw new Exception(Resources.AdvancedGod_ChildNamingNotSupported, e);
     }
 }
Esempio n. 2
0
 private static CoupleAttribute GetAttribute(Human firstHuman, Human secondHuman)
 {
     var enumerator = new CoupleAttributeEnumerator(firstHuman.GetType());
     while (enumerator.MoveNext())
     {
         if (enumerator.Current.Pair.Equals(secondHuman.GetType().Name))
         {
             return enumerator.Current;
         }
     }
     throw new WrongCoupleException(Resources.AdvancedGod_IncompatibleTypes);
 }