LiveCodingChat.MainClass.ReadLoginMethod C# (CSharp) Метод

ReadLoginMethod() статический приватный Метод

static private ReadLoginMethod ( ) : ILoginMethod
Результат ILoginMethod
        static ILoginMethod ReadLoginMethod()
        {
            List<Type> types = new List<Type>();
            int i = 0;
            foreach (Type t in System.Reflection.Assembly.GetEntryAssembly().GetTypes()) {
                if (typeof(ILoginMethod).IsAssignableFrom (t) && !t.IsInterface && !t.IsAbstract) {
                    types.Add (t);
                    Console.WriteLine ("[" + i.ToString () + "] " + t.Name);
                    i++;
                }
            }
            int parsed = 0;
            do {
                Console.Write ("Use Login Method:");
            } while(!int.TryParse (Console.ReadLine (), out parsed) || parsed >= types.Count || parsed <0);
            return (ILoginMethod)types [parsed].GetConstructor (new Type[]{ }).Invoke (new object[]{ });
        }