internal static void GetExcelServerInfos(Type t, object[] attribs, List<ExcelServerInfo> excelServerInfos)
        {
            bool isUdfClass = false;
            foreach (object attrib in attribs)
            {
                Type attribType = attrib.GetType();
                if (attribType.FullName == "Microsoft.Office.Excel.Server.Udf.UdfClassAttribute")
                {
                    // Candidate for export
                    isUdfClass = true;
                    break;
                }
            }
            if (!isUdfClass) return;

            // Instantiate -- the class must have a parameterless constructor
            ConstructorInfo ci = t.GetConstructor(new Type[0]);
            if (ci == null)
            {
                // Bad case
                Debug.Print("ExcelDNA -> UdfClass: " + t.FullName + " has no parameterless constructor.");
                return;
            }

            try
            {
                object instance = ci.Invoke(null);
                ExcelServerInfo serverInfo = new ExcelServerInfo();
                excelServerInfos.Add(serverInfo);
                serverInfo.Instance = instance;
                serverInfo.Methods = new List<MethodInfo>();

                // Now go through all the methods, finding those with the UdfMethod attribute
                foreach (MethodInfo method in t.GetMethods(BindingFlags.Public | BindingFlags.Instance))
                {
                    // Simple check that this is a function
                    if (method.ReturnType == typeof(void))
                    {
                        // Bad case
                        Debug.Print("ExcelDNA -> UdfMethod: " + method.Name + " returns void.");
                        continue;
                    }

                    foreach (object attrib in method.GetCustomAttributes(false))
                    {
                        // CONSIDER: Does this GetType() require that the assembly which defines
                        // the attribute be available?
                        Type attribType = attrib.GetType();

                        if (attribType.FullName == "Microsoft.Office.Excel.Server.Udf.UdfMethodAttribute")
                        {
                            // Candidate for export
                            serverInfo.Methods.Add(method);
                        }
                    }
                }
            }
            catch { }
        }
        internal static void GetExcelServerInfos(Type t, object[] attribs, List <ExcelServerInfo> excelServerInfos)
        {
            bool isUdfClass = false;

            foreach (object attrib in attribs)
            {
                Type attribType = attrib.GetType();
                if (attribType.FullName == "Microsoft.Office.Excel.Server.Udf.UdfClassAttribute")
                {
                    // Candidate for export
                    isUdfClass = true;
                    break;
                }
            }
            if (!isUdfClass)
            {
                return;
            }

            // Instantiate -- the class must have a parameterless constructor
            ConstructorInfo ci = t.GetConstructor(new Type[0]);

            if (ci == null)
            {
                // Bad case
                Debug.Print("ExcelDNA -> UdfClass: " + t.FullName + " has no parameterless constructor.");
                return;
            }

            try
            {
                object          instance   = ci.Invoke(null);
                ExcelServerInfo serverInfo = new ExcelServerInfo();
                excelServerInfos.Add(serverInfo);
                serverInfo.Instance = instance;
                serverInfo.Methods  = new List <MethodInfo>();

                // Now go through all the methods, finding those with the UdfMethod attribute
                foreach (MethodInfo method in t.GetMethods(BindingFlags.Public | BindingFlags.Instance))
                {
                    // Simple check that this is a function
                    if (method.ReturnType == typeof(void))
                    {
                        // Bad case
                        Debug.Print("ExcelDNA -> UdfMethod: " + method.Name + " returns void.");
                        continue;
                    }

                    foreach (object attrib in method.GetCustomAttributes(false))
                    {
                        // CONSIDER: Does this GetType() require that the assembly which defines
                        // the attribute be available?
                        Type attribType = attrib.GetType();

                        if (attribType.FullName == "Microsoft.Office.Excel.Server.Udf.UdfMethodAttribute")
                        {
                            // Candidate for export
                            serverInfo.Methods.Add(method);
                        }
                    }
                }
            }
            catch { }
        }