当前位置: 首页>>代码示例>>C#>>正文


C# Methods.Add方法代码示例

本文整理汇总了C#中System.Methods.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Methods.Add方法的具体用法?C# Methods.Add怎么用?C# Methods.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Methods的用法示例。


在下文中一共展示了Methods.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DescribeMethods

 internal virtual Methods DescribeMethods()
 {
     Methods methods = new Methods();
     methods.Add(new Method("GetWorklistItems", MethodType.List, new MetaData("Get Worklist Items", "Returns a collection of worklist items."), GetRequiredProperties("GetWorklistItems"), GetMethodParameters("GetWorklistItems"), GetInputProperties("GetWorklistItems"), GetReturnProperties("GetWorklistItems")));
     methods.Add(new Method("LoadWorklistItem", MethodType.Read, new MetaData("Load Worklist Item", "Returns the specified worklist item."), GetRequiredProperties("LoadWorklistItem"), GetMethodParameters("LoadWorklistItem"), GetInputProperties("LoadWorklistItem"), GetReturnProperties("LoadWorklistItem")));
     return methods;
 }
开发者ID:jonnoking,项目名称:K2PowershellLibaries,代码行数:7,代码来源:BasicWorklistItem.cs

示例2: GenerateInterfaceStubs

        void GenerateInterfaceStubs(Type interfaceType)
        {
            WriteLine();
            /*
            WriteLine("public partial class {0}_", interfaceType.SimpleName);
            WriteLine("{");
            myIndent++;
            WriteLine("public static global::java.lang.Class _class");
            WriteLine("{");
            myIndent++;
            WriteLine("get {{ return __{0}.staticClass; }}", interfaceType.SimpleName);
            myIndent--;
            WriteLine("}");
            myIndent--;
            WriteLine("}");
            WriteLine();
            */
            
            Type wrapperType = new Type();
            wrapperType.WrappedInterface = interfaceType.Name;
            wrapperType.WrappedInterfaceType = interfaceType;
            //wrapperType.Name = interfaceType.Name.Insert(interfaceType.Name.LastIndexOf('.') + 1, "_");
            wrapperType.Name = interfaceType.Name + "_";
            wrapperType.Scope = interfaceType.Scope;
            wrapperType.IsSealed = true;
            if (interfaceType.IsInterface)
            {
                wrapperType.Parent = "java.lang.Object";
                wrapperType.ParentType = myModel.FindType("java.lang.Object");
                wrapperType.Interfaces.Add(interfaceType.Name);
                wrapperType.InterfaceTypes.Add(interfaceType);

                var h = new HashSet<Type>();
                AddAllInterfaces(interfaceType, h);
                foreach (var i in h)
                {
                    foreach (var m in i.Methods)
                    {
                        var mc = new Method();
                        mc.Type = wrapperType;
                        mc.Name = i.Name + "." + m.Name;
                        //mc.Scope = "public";
                        mc.Parameters.AddRange(m.Parameters);
                        mc.ParameterTypes.AddRange(m.ParameterTypes);
                        mc.Return = m.Return;
                        mc.ReturnType = m.ReturnType;
                        if (!wrapperType.Methods.Contains(mc))
                            wrapperType.Methods.Add(mc);
                    }
                }
            }
            else
            {
                wrapperType.Parent = interfaceType.Name;
                wrapperType.ParentType = interfaceType;

                var curType = interfaceType;
                var allImplementedMethods = new Methods();
                while (curType != null)
                {
                    foreach (var m in curType.Methods)
                    {
                        if (!m.Abstract)
                        {
                            if (!allImplementedMethods.Contains(m))
                                allImplementedMethods.Add(m);
                            continue;
                        }
                        if (allImplementedMethods.Contains(m))
                            continue;
                        var mc = new Method();
                        mc.Type = wrapperType;
                        mc.Name = m.Name;
                        mc.Scope = m.Scope;
                        mc.IsOverride = true;
                        mc.Parameters.AddRange(m.Parameters);
                        mc.ParameterTypes.AddRange(m.ParameterTypes);
                        mc.Return = m.Return;
                        mc.ReturnType = m.ReturnType;
                        if (!wrapperType.Methods.Contains(mc))
                            wrapperType.Methods.Add(mc);
                    }
                    curType = curType.ParentType;
                }
            }
            
            myTypesOfInterest.Add(wrapperType);
            myIndent--;
            GenerateType(wrapperType);
            myIndent++;
        }
开发者ID:nagyist,项目名称:androidmono,代码行数:91,代码来源:NetProxyGenerator.cs

示例3: GenerateInterfaceStubs

        void GenerateInterfaceStubs(Type interfaceType)
        {
            WriteLine();

            Type wrapperType = new Type();
            wrapperType.WrappedInterface = interfaceType.Name;
            wrapperType.WrappedInterfaceType = interfaceType;
            wrapperType.Name = interfaceType.Name + "_";
            wrapperType.Scope = interfaceType.Scope;
            wrapperType.IsSealed = true;
            if (interfaceType.IsInterface)
            {
                wrapperType.Parent = "java.lang.Object";
                wrapperType.ParentType = myModel.FindType("java.lang.Object");
                wrapperType.Interfaces.Add(interfaceType.Name);
                wrapperType.InterfaceTypes.Add(interfaceType);
                wrapperType.Scope = "internal";

                var h = new HashSet<Type>();
                AddAllInterfaces(interfaceType, h);
                foreach (var i in h)
                {
                    foreach (var m in i.Methods)
                    {
                        var mc = new Method();
                        mc.Type = wrapperType;
                        mc.Name = i.Name + "." + m.Name;
                        mc.Parameters.AddRange(m.Parameters);
                        mc.ParameterTypes.AddRange(m.ParameterTypes);
                        mc.Return = m.Return;
                        mc.ReturnType = m.ReturnType;
                        if (!wrapperType.Methods.Contains(mc))
                            wrapperType.Methods.Add(mc);
                    }
                }
            }
            else
            {
                wrapperType.Scope = "internal";
                wrapperType.Parent = interfaceType.Name;
                wrapperType.ParentType = interfaceType;

                var curType = interfaceType;
                var allImplementedMethods = new Methods();
                while (curType != null)
                {
                    foreach (var m in curType.Methods)
                    {
                        if (!m.Abstract)
                        {
                            if (!allImplementedMethods.Contains(m))
                                allImplementedMethods.Add(m);
                            continue;
                        }
                        if (allImplementedMethods.Contains(m))
                            continue;
                        var mc = new Method();
                        mc.Type = wrapperType;
                        mc.Name = m.Name;
                        mc.Scope = m.Scope;
                        mc.IsOverride = true;
                        mc.Parameters.AddRange(m.Parameters);
                        mc.ParameterTypes.AddRange(m.ParameterTypes);
                        mc.Return = m.Return;
                        mc.ReturnType = m.ReturnType;
                        if (!wrapperType.Methods.Contains(mc))
                            wrapperType.Methods.Add(mc);
                    }
                    curType = curType.ParentType;
                }
            }

            myIndent--;
            myTypesOfInterest.Add(wrapperType);
            GenerateType(wrapperType);
            myIndent++;

            if (interfaceType.IsDelegate)
            {
                WriteLine();
                var delegateMethod = interfaceType.Methods.First();
                Write("public delegate {0} {1}Delegate(", false, delegateMethod.Return, interfaceType.SimpleName);
                WriteDelimited(delegateMethod.Parameters, (v, i) => string.Format("{0} arg{1}", v, i), ",");
                WriteLine(");");
                WriteLine();
                var delegateWrapper = new Type();
                myTypesOfInterest.Add(delegateWrapper);
                delegateWrapper.Name = interfaceType.Name + "DelegateWrapper";
                delegateWrapper.NativeName = interfaceType.NativeName.Replace('$', '_') + "DelegateWrapper";
                if (delegateWrapper.NativeName.StartsWith("java."))
                    delegateWrapper.NativeName = delegateWrapper.NativeName.Replace("java.", "internal.java.");
                delegateWrapper.HasEmptyConstructor = true;
                delegateWrapper.Scope = "internal";
                delegateWrapper.Parent = "java.lang.Object";
                delegateWrapper.ParentType = myModel.FindType("java.lang.Object");
                delegateWrapper.NoAttributes = true;
                var constructor = new Method();
                constructor.IsConstructor = true;
                constructor.Scope = "public";
                constructor.Type = delegateWrapper;
//.........这里部分代码省略.........
开发者ID:JeroMiya,项目名称:androidmono,代码行数:101,代码来源:NetProxyGenerator.cs

示例4: DescribeMethods

 private SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods DescribeMethods()
 {
     SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods methods = new Methods();
     methods.Add(new Method("GetWorklistItems", MethodType.List, new MetaData("Get Worklist Items", "Returns a collection of worklist items."), GetRequiredProperties("GetWorklistItems"), GetMethodParameters("GetWorklistItems"), GetInputProperties("GetWorklistItems"), GetReturnProperties("GetWorklistItems")));
     methods.Add(new Method("LoadWorklistItem", MethodType.Read, new MetaData("Load Worklist Item", "Returns the specified worklist item."), GetRequiredProperties("LoadWorklistItem"), GetMethodParameters("LoadWorklistItem"), GetInputProperties("LoadWorklistItem"), GetReturnProperties("LoadWorklistItem")));
     return methods;
 }
开发者ID:hoshyK2,项目名称:K2-Worklist-Service-Broker,代码行数:7,代码来源:BasicWorklistItem.cs

示例5: DescribeMethods

 private SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods DescribeMethods()
 {
     SourceCode.SmartObjects.Services.ServiceSDK.Objects.Methods methods = new Methods();
     methods.Add(new Method("GetWorklistItemActions", MethodType.List, new MetaData("Get Worklist Item Actions", "Returns a collection of worklist item actions."), GetRequiredProperties("GetWorklistItemActions"), GetMethodParameters("GetWorklistItemActions"), GetInputProperties("GetWorklistItemActions"), GetReturnProperties("GetWorklistItemActions")));
     methods.Add(new Method("RedirectWorklistItem", MethodType.Execute, new MetaData("Redirect Worklist Item", ""), GetRequiredProperties("RedirectWorklistItem"), GetMethodParameters("RedirectWorklistItem"), GetInputProperties("RedirectWorklistItem"), GetReturnProperties("RedirectWorklistItem")));
     methods.Add(new Method("RedirectManagedUserWorklistItem", MethodType.Execute, new MetaData("Redirect Managed User Worklist Item", ""), GetRequiredProperties("RedirectManagedUserWorklistItem"), GetMethodParameters("RedirectManagedUserWorklistItem"), GetInputProperties("RedirectManagedUserWorklistItem"), GetReturnProperties("RedirectManagedUserWorklistItem")));
     methods.Add(new Method("ActionWorklistItem", MethodType.Execute, new MetaData("Action Worklist Item", ""), GetRequiredProperties("ActionWorklistItem"), GetMethodParameters("ActionWorklistItem"), GetInputProperties("ActionWorklistItem"), GetReturnProperties("ActionWorklistItem")));
     methods.Add(new Method("OpenWorklistItem", MethodType.Execute, new MetaData("Open Worklist Item", ""), GetRequiredProperties("OpenWorklistItem"), GetMethodParameters("OpenWorklistItem"), GetInputProperties("OpenWorklistItem"), GetReturnProperties("OpenWorklistItem")));
     methods.Add(new Method("ReleaseWorklistItem", MethodType.Execute, new MetaData("Release Worklist Item", ""), GetRequiredProperties("ReleaseWorklistItem"), GetMethodParameters("ReleaseWorklistItem"), GetInputProperties("ReleaseWorklistItem"), GetReturnProperties("ReleaseWorklistItem")));
     return methods;
 }
开发者ID:jonnoking,项目名称:K2PowershellLibaries,代码行数:11,代码来源:WorklistAction.cs


注:本文中的System.Methods.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。