System.Type.GetMethods C# (CSharp) Method

GetMethods() public method

public GetMethods ( ) : MethodInfo[]
return MethodInfo[]
        public MethodInfo[] GetMethods()
        {
            IEnumerable<MethodInfo> result = methods;
            if (baseType != null)
                result = BaseType.GetMethods().Concat(result);
            return result.ToArray();
        }

Usage Example

Ejemplo n.º 1
5
 /// <summary>
 /// Создает на основе типа фильтр
 /// </summary>
 /// <param name="lib"></param>
 /// <param name="type"></param>
 public Filter(string lib, Type type)
 {
     libname = lib;
     if (type.BaseType == typeof(AbstractFilter))
     {
         Exception fullex = new Exception("");
         ConstructorInfo ci = type.GetConstructor(System.Type.EmptyTypes);
         filter = ci.Invoke(null);
         PropertyInfo everyprop;
         everyprop = type.GetProperty("Name");
         name = (string)everyprop.GetValue(filter, null);
         everyprop = type.GetProperty("Author");
         author = (string)everyprop.GetValue(filter, null);
         everyprop = type.GetProperty("Ver");
         version = (Version)everyprop.GetValue(filter, null);
         help = type.GetMethod("Help");
         MethodInfo[] methods = type.GetMethods();
         filtrations = new List<Filtration>();
         foreach (MethodInfo mi in methods)
             if (mi.Name == "Filter")
             {
                 try
                 {
                     filtrations.Add(new Filtration(mi));
                 }
                 catch (TypeLoadException)
                 {
                     //Не добавляем фильтрацию.
                 }
             }
         if (filtrations == null) throw new TypeIncorrectException("Класс " + name + " не содержит ни одной фильтрации");
     }
     else
         throw new TypeLoadException("Класс " + type.Name + " не наследует AbstractFilter");
 }
All Usage Examples Of System.Type::GetMethods