本文整理汇总了C#中IMethod类的典型用法代码示例。如果您正苦于以下问题:C# IMethod类的具体用法?C# IMethod怎么用?C# IMethod使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMethod类属于命名空间,在下文中一共展示了IMethod类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MemberNode
public MemberNode(IMethod method)
{
InitMemberNode(method);
sortOrder = 10;
Text = AppendReturnType(GetAmbience().Convert(method), method.ReturnType);
SelectedImageIndex = ImageIndex = ClassBrowserIconService.GetIcon(method).ImageIndex;
}
示例2: OverrideEqualsGetHashCodeMethodsDialog
public OverrideEqualsGetHashCodeMethodsDialog(InsertionContext context, ITextEditor editor, ITextAnchor endAnchor,
ITextAnchor insertionPosition, ITypeDefinition selectedClass, IMethod selectedMethod, AstNode baseCallNode)
: base(context, editor, insertionPosition)
{
if (selectedClass == null)
throw new ArgumentNullException("selectedClass");
InitializeComponent();
this.selectedClass = selectedClass;
this.insertionEndAnchor = endAnchor;
this.selectedMethod = selectedMethod;
this.baseCallNode = baseCallNode;
addIEquatable.Content = string.Format(StringParser.Parse("${res:AddIns.SharpRefactoring.OverrideEqualsGetHashCodeMethods.AddInterface}"),
"IEquatable<" + selectedClass.Name + ">");
string otherMethod = selectedMethod.Name == "Equals" ? "GetHashCode" : "Equals";
addOtherMethod.Content = StringParser.Parse("${res:AddIns.SharpRefactoring.OverrideEqualsGetHashCodeMethods.AddOtherMethod}", new StringTagPair("otherMethod", otherMethod));
addIEquatable.IsEnabled = !selectedClass.GetAllBaseTypes().Any(
type => {
if (!type.IsParameterized || (type.TypeParameterCount != 1))
return false;
if (type.FullName != "System.IEquatable")
return false;
return type.TypeArguments.First().FullName == selectedClass.FullName;
}
);
}
示例3: OnMethod
public override void OnMethod(Method node)
{
var old = _currentMethod;
_currentMethod = (IMethod) node.Entity;
base.OnMethod(node);
_currentMethod = old;
}
示例4: CompareTo
public virtual int CompareTo(IMethod value)
{
int cmp;
cmp = base.CompareTo((IDecoration)value);
if (cmp != 0) {
return cmp;
}
if (FullyQualifiedName != null) {
cmp = FullyQualifiedName.CompareTo(value.FullyQualifiedName);
if (cmp != 0) {
return cmp;
}
}
if (ReturnType != null) {
cmp = ReturnType.CompareTo(value.ReturnType);
if (cmp != 0) {
return cmp;
}
}
if (Region != null) {
cmp = Region.CompareTo(value.Region);
if (cmp != 0) {
return cmp;
}
}
return DiffUtility.Compare(Parameters, value.Parameters);
}
示例5: DefaultTypeParameter
public DefaultTypeParameter(IMethod method, Type type)
{
this.method = method;
this.targetClass = method.DeclaringType;
this.name = type.Name;
this.index = type.GenericParameterPosition;
}
示例6: CreateRequiredConstructor
internal CodeConstructor CreateRequiredConstructor(CodeTypeDeclaration resourceClass,
IMethod request,
bool addOptionalParameters)
{
var constructor = new CodeConstructor();
constructor.Attributes = MemberAttributes.Public;
// IRequestProvider service
var serviceArg = new CodeParameterDeclarationExpression(typeof(IRequestProvider), ServiceName);
constructor.Parameters.Add(serviceArg);
// : base(service, "path", "HTTPMETHOD")
constructor.BaseConstructorArgs.Add(
new CodePropertyReferenceExpression(
new CodeVariableReferenceExpression(ServiceName), BaseUriName));
constructor.BaseConstructorArgs.Add(new CodePrimitiveExpression(request.MediaUpload.Simple.Path));
constructor.BaseConstructorArgs.Add(new CodePrimitiveExpression(request.HttpMethod));
// Add all required arguments to the constructor.
AddBodyParameter(constructor, request);
// Add common upload arguements.
constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression(StreamParameterName));
constructor.BaseConstructorArgs.Add(new CodeVariableReferenceExpression(ContentTypeParameterName));
AddAuthorizationAssignment(constructor);
AddRequestParameters(resourceClass, request, constructor, addOptionalParameters);
constructor.Parameters.Add(new CodeParameterDeclarationExpression(
new CodeTypeReference(typeof(System.IO.Stream)), StreamParameterName));
constructor.Parameters.Add(new CodeParameterDeclarationExpression(
new CodeTypeReference(typeof(System.String)), ContentTypeParameterName));
return constructor;
}
示例7: GetMethodSemantics
private MethodScriptSemantics GetMethodSemantics(IMethod m) {
if (m.IsAccessor) {
var prop = m.AccessorOwner as IProperty;
if (prop != null) {
var psem = _metadataImporter.GetPropertySemantics(prop);
if (psem.Type != PropertyScriptSemantics.ImplType.GetAndSetMethods)
throw new InvalidOperationException("Property " + prop.Name + " should be implemented with get/set methods");
if (m.Equals(prop.Getter))
return psem.GetMethod;
else if (m.Equals(prop.Setter))
return psem.SetMethod;
else
throw new Exception(m + " is neither the getter nor the setter for " + prop);
}
var evt = m.AccessorOwner as IEvent;
if (evt != null) {
var esem = _metadataImporter.GetEventSemantics(evt);
if (esem.Type != EventScriptSemantics.ImplType.AddAndRemoveMethods)
throw new InvalidOperationException("Event " + prop.Name + " should be implemented with add/remove methods");
if (m.Equals(evt.AddAccessor))
return esem.AddMethod;
else if (m.Equals(evt.RemoveAccessor))
return esem.RemoveMethod;
else
throw new Exception(m + " is neither the adder nor the remover for " + evt);
}
throw new ArgumentException("Invalid accessor owner " + m.AccessorOwner + " on member " + m);
}
else
return _metadataImporter.GetMethodSemantics(m);
}
示例8: Exists
public bool Exists(IMethod method) {
if (method == null)
return false;
if (method.DeclaringType != null && types.Find(method.DeclaringType))
return true;
return methods.Find(method);
}
示例9: DecorateClass
public override void DecorateClass(IResource resource,
IMethod request,
CodeTypeDeclaration requestClass,
CodeTypeDeclaration resourceClass)
{
requestClass.Members.Add(CreateRequiredConstructor(resourceClass, request, false));
}
示例10: ExternalGenericParameter
public ExternalGenericParameter(IReflectionTypeSystemProvider provider, Type type) : base(provider, type)
{
if (type.DeclaringMethod != null)
{
_declaringMethod = (IMethod)provider.Map(type.DeclaringMethod);
}
}
示例11: IsValidTestMethod
public bool IsValidTestMethod(IProject project, IClass testClass, IMethod testMethod)
{
if (project == null || testClass == null || testMethod == null)
return false;
return IsValidTestMethod(project, testClass.GetClrName().FullName, testMethod.ShortName);
}
示例12: DefaultMethod
/// <summary>
/// Copy constructor
/// </summary>
protected DefaultMethod(IMethod method) : base(method)
{
returnTypeAttributes = CopyList(method.ReturnTypeAttributes);
typeParameters = CopyList(method.TypeParameters);
parameters = CopyList(method.Parameters);
this.IsExtensionMethod = method.IsExtensionMethod;
}
示例13: AddSenderAndEventArgsParameters
void AddSenderAndEventArgsParameters(IMethod method)
{
DefaultReturnType returnType = new DefaultReturnType(method.DeclaringType);
DomRegion region = new DomRegion();
method.Parameters.Add(new DefaultParameter("sender", returnType, region));
method.Parameters.Add(new DefaultParameter("e", returnType, region));
}
示例14: MethodDrop
public MethodDrop(ITable table, IMethod method)
: base(method)
{
this.table = table;
this.method = method;
tableMemberDrop = new TableMemberDrop(table, method);
}
示例15: StringFormatWriter
public StringFormatWriter(ModuleDeclaration module)
{
this.module = module;
ITypeSignature stringType = module.Cache.GetType(typeof(string));
this.format1Method = module.FindMethod(stringType, "Format",
method => method.Parameters.Count == 2 &&
IntrinsicTypeSignature.Is(method.Parameters[0].ParameterType, IntrinsicType.String) &&
IntrinsicTypeSignature.Is(method.Parameters[1].ParameterType, IntrinsicType.Object));
this.format2Method = module.FindMethod(stringType, "Format",
method => method.Parameters.Count == 3 &&
IntrinsicTypeSignature.Is(method.Parameters[0].ParameterType, IntrinsicType.String) &&
IntrinsicTypeSignature.Is(method.Parameters[1].ParameterType, IntrinsicType.Object) &&
IntrinsicTypeSignature.Is(method.Parameters[2].ParameterType, IntrinsicType.Object));
this.format3Method = module.FindMethod(stringType, "Format",
method => method.Parameters.Count == 4 &&
IntrinsicTypeSignature.Is(method.Parameters[0].ParameterType, IntrinsicType.String) &&
IntrinsicTypeSignature.Is(method.Parameters[1].ParameterType, IntrinsicType.Object) &&
IntrinsicTypeSignature.Is(method.Parameters[2].ParameterType, IntrinsicType.Object) &&
IntrinsicTypeSignature.Is(method.Parameters[3].ParameterType, IntrinsicType.Object));
this.formatArrayMethod = module.FindMethod(stringType, "Format",
method => method.Parameters.Count == 2 &&
IntrinsicTypeSignature.Is(method.Parameters[0].ParameterType, IntrinsicType.String) &&
method.Parameters[1].ParameterType.BelongsToClassification(TypeClassifications.Array));
}