本文整理汇总了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;
}
示例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++;
}
示例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;
//.........这里部分代码省略.........
示例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;
}
示例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;
}