本文整理汇总了C#中System.Methods.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# Methods.Contains方法的具体用法?C# Methods.Contains怎么用?C# Methods.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Methods
的用法示例。
在下文中一共展示了Methods.Contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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++;
}
示例2: 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;
//.........这里部分代码省略.........