예제 #1
0
            void Initialize()
            {
                IEnumerable <Type> classentries = Altaxo.Main.Services.ReflectionService.GetUnsortedClassTypesHavingAttribute(typeof(FitFunctionClassAttribute), true);

                SortedList <FitFunctionCreatorAttribute, System.Reflection.MethodInfo> list = new SortedList <FitFunctionCreatorAttribute, System.Reflection.MethodInfo>();

                foreach (Type definedtype in classentries)
                {
                    System.Reflection.MethodInfo[] methods = definedtype.GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
                    foreach (System.Reflection.MethodInfo method in methods)
                    {
                        if (method.IsStatic && method.ReturnType != typeof(void) && method.GetParameters().Length == 0)
                        {
                            object[] attribs = method.GetCustomAttributes(typeof(FitFunctionCreatorAttribute), false);
                            foreach (FitFunctionCreatorAttribute creatorattrib in attribs)
                            {
                                list.Add(creatorattrib, method);
                            }
                        }
                    }
                }


                _fitFunctions = new BuiltinFitFunctionInformation[list.Count];
                int j = 0;

                foreach (KeyValuePair <FitFunctionCreatorAttribute, System.Reflection.MethodInfo> entry in list)
                {
                    _fitFunctions[j++] = new BuiltinFitFunctionInformation(entry.Key, entry.Value);
                }
            }
예제 #2
0
      void Initialize()
      {
        IEnumerable<Type> classentries = Altaxo.Main.Services.ReflectionService.GetUnsortedClassTypesHavingAttribute(typeof(FitFunctionClassAttribute),true);

        SortedList<FitFunctionCreatorAttribute,System.Reflection.MethodInfo> list = new SortedList<FitFunctionCreatorAttribute,System.Reflection.MethodInfo>();

        foreach (Type definedtype in classentries)
        {
          System.Reflection.MethodInfo[] methods = definedtype.GetMethods(System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public);
          foreach (System.Reflection.MethodInfo method in methods)
          {
            if (method.IsStatic && method.ReturnType != typeof(void) && method.GetParameters().Length == 0)
            {
              object[] attribs = method.GetCustomAttributes(typeof(FitFunctionCreatorAttribute), false);
              foreach (FitFunctionCreatorAttribute creatorattrib in attribs)
                list.Add(creatorattrib, method);
            }
          }
        }


        _fitFunctions = new BuiltinFitFunctionInformation[list.Count];
        int j = 0;
        foreach (KeyValuePair<FitFunctionCreatorAttribute,System.Reflection.MethodInfo> entry in list)
        {
          _fitFunctions[j++] = new BuiltinFitFunctionInformation(entry.Key, entry.Value); 
        }


      }