• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMemberRef类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMemberRef的典型用法代码示例。如果您正苦于以下问题:C# IMemberRef类的具体用法?C# IMemberRef怎么用?C# IMemberRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMemberRef类属于命名空间,在下文中一共展示了IMemberRef类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TryCreateAnalyzer

		public static AnalyzerTreeNode TryCreateAnalyzer(IMemberRef member)
		{
			if (CanShow(member))
				return new AnalyzedPropertyTreeNode(member as PropertyDef);
			else
				return null;
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:7,代码来源:AnalyzedPropertyTreeNode.cs


示例2: ResolveMemberDef

        static IMemberDef ResolveMemberDef(IMemberRef @ref)
        {
            if (@ref is ITypeDefOrRef)
                return ((ITypeDefOrRef)@ref).ResolveTypeDef();

            if (@ref is IMethod && ((IMethod)@ref).MethodSig != null) {
                var m = (IMethod)@ref;
                if (m is MethodSpec)
                    m = ((MethodSpec)m).Method;
                if (m is MemberRef)
                    return ((MemberRef)m).ResolveMethod();
                return m as MethodDef;
            }

            if (@ref is IField) {
                var f = (IField)@ref;
                if (f is MemberRef)
                    return ((MemberRef)f).ResolveField();
                return f as FieldDef;
            }

            if (@ref is PropertyDef)
                return (PropertyDef)@ref;

            if (@ref is EventDef)
                return (EventDef)@ref;

            return null;
        }
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:29,代码来源:TreeNodeReferenceFileTabContentCreator.cs


示例3: IsPublic

		static bool IsPublic(IMemberRef memberRef)
		{
			var def = Resolve(memberRef);
			if (def is TypeDef)
				return IsAccessible((TypeDef)def);

			var md = def as IMemberDef;
			if (md == null)
				return false;
			if (!IsAccessible(md.DeclaringType))
				return false;

			var method = def as MethodDef;
			if (method != null)
				return IsAccessible(method);

			var field = def as FieldDef;
			if (field != null)
				return IsAccessible(field);

			var prop = def as PropertyDef;
			if (prop != null)
				return IsAccessible(prop);

			var evt = def as EventDef;
			if (evt != null)
				return IsAccessible(evt);

			return false;
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:30,代码来源:SearchMsdnContextMenuEntry.cs


示例4: BookmarkBase

 public BookmarkBase(IMemberRef member, uint ilOffset, TextLocation location, TextLocation endLocation)
 {
     this.MemberReference = member;
     this.ilOffset = ilOffset;
     this.Location = location;
     this.EndLocation = endLocation;
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:7,代码来源:BookmarkBase.cs


示例5: Write

		public static bool Write(IDecompilerOutput output, IMemberRef member) {
			var method = member as IMethod;
			if (method != null && method.IsMethod) {
				method.WriteMethodTo(output);
				return true;
			}

			var field = member as IField;
			if (field != null && field.IsField) {
				field.WriteFieldTo(output);
				return true;
			}

			var prop = member as PropertyDef;
			if (prop != null) {
				var dis = new ReflectionDisassembler(output, false, new DisassemblerOptions(new System.Threading.CancellationToken(), null));
				dis.DisassembleProperty(prop, false);
				return true;
			}

			var evt = member as EventDef;
			if (evt != null) {
				var dis = new ReflectionDisassembler(output, false, new DisassemblerOptions(new System.Threading.CancellationToken(), null));
				dis.DisassembleEvent(evt, false);
				return true;
			}

			var type = member as ITypeDefOrRef;
			if (type != null) {
				type.WriteTo(output, ILNameSyntax.TypeName);
				return true;
			}

			return false;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:35,代码来源:ILDecompilerUtils.cs


示例6: TryCreateAnalyzer

 public static AnalyzerTreeNode TryCreateAnalyzer(IMemberRef member)
 {
     if (CanShow(member))
         return new AnalyzedEventTreeNode(member as EventDef);
     else
         return null;
 }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:7,代码来源:AnalyzedEventTreeNode.cs


示例7: GetDocumentation

		string GetDocumentation(XmlDocumentationProvider docProvider, IMemberRef mr) {
			var sb = new StringBuilder();
			var doc = docProvider.GetDocumentation(XmlDocKeyProvider.GetKey(mr, sb));
			if (doc != null)
				return doc;
			var method = mr as IMethod;
			if (method == null)
				return null;
			string name = method.Name;
			if (name.StartsWith("set_") || name.StartsWith("get_")) {
				var md = Resolve(method) as MethodDef;
				if (md == null)
					return null;
				mr = md.DeclaringType.Properties.FirstOrDefault(p => p.GetMethod == md || p.SetMethod == md);
				return docProvider.GetDocumentation(XmlDocKeyProvider.GetKey(mr, sb));
			}
			else if (name.StartsWith("add_")) {
				var md = Resolve(method) as MethodDef;
				if (md == null)
					return null;
				mr = md.DeclaringType.Events.FirstOrDefault(p => p.AddMethod == md);
				return docProvider.GetDocumentation(XmlDocKeyProvider.GetKey(mr, sb));
			}
			else if (name.StartsWith("remove_")) {
				var md = Resolve(method) as MethodDef;
				if (md == null)
					return null;
				mr = md.DeclaringType.Events.FirstOrDefault(p => p.RemoveMethod == md);
				return docProvider.GetDocumentation(XmlDocKeyProvider.GetKey(mr, sb));
			}
			return null;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:32,代码来源:DnlibReferenceToolTipContentCreator.cs


示例8: GetKey

 public static string GetKey(IMemberRef member)
 {
     if (member == null)
         return null;
     StringBuilder b = new StringBuilder();
     if (member is ITypeDefOrRef) {
         b.Append("T:");
         AppendTypeName(b, ((ITypeDefOrRef)member).ToTypeSig());
     }
     else {
         if (member.IsField)
             b.Append("F:");
         else if (member.IsPropertyDef)
             b.Append("P:");
         else if (member.IsEventDef)
             b.Append("E:");
         else if (member.IsMethod)
             b.Append("M:");
         AppendTypeName(b, member.DeclaringType.ToTypeSig());
         b.Append('.');
         b.Append(member.Name.Replace('.', '#'));
         IList<Parameter> parameters;
         TypeSig explicitReturnType = null;
         if (member.IsPropertyDef) {
             parameters = GetParameters((PropertyDef)member).ToList();
         }
         else if (member.IsMethod) {
             var mr = (IMethod)member;
             if (mr.NumberOfGenericParameters > 0) {
                 b.Append("``");
                 b.Append(mr.NumberOfGenericParameters);
             }
             parameters = mr.GetParameters();
             if (mr.Name == "op_Implicit" || mr.Name == "op_Explicit") {
                 explicitReturnType = mr.MethodSig.GetRetType();
             }
         }
         else {
             parameters = null;
         }
         if (parameters != null && parameters.Any(a => a.IsNormalMethodParameter)) {
             b.Append('(');
             for (int i = 0; i < parameters.Count; i++) {
                 var param = parameters[i];
                 if (!param.IsNormalMethodParameter)
                     continue;
                 if (param.MethodSigIndex > 0)
                     b.Append(',');
                 AppendTypeName(b, param.Type);
             }
             b.Append(')');
         }
         if (explicitReturnType != null) {
             b.Append('~');
             AppendTypeName(b, explicitReturnType);
         }
     }
     return b.ToString();
 }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:59,代码来源:XmlDocKeyProvider.cs


示例9: CanShow

		public static bool CanShow(IMemberRef member, ILanguage language) {
			var property = member as PropertyDef;
			if (property == null)
				return false;

			return !language.ShowMember(property.GetMethod ?? property.SetMethod)
				|| PropertyOverridesNode.CanShow(property);
		}
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:8,代码来源:PropertyNode.cs


示例10: BreakpointBookmark

 public BreakpointBookmark(IMemberRef member, TextLocation location, int functionToken, ILRange range, BreakpointAction action)
     : base(member, location)
 {
     this.action = action;
     this.FunctionToken = functionToken;
     this.ILRange = range;
     this.Tooltip = string.Format("Line:{0}, IL range:{1}-{2}", location.Line, range.From, range.To);
 }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:8,代码来源:BreakpointBookmark.cs


示例11: JumpTo

 public static bool JumpTo(DecompilerTextView textView, IMemberRef mr, MethodKey key, int ilOffset)
 {
     return MainWindow.Instance.JumpToReference(textView, mr, (success, hasMovedCaret) => {
         if (success)
             return MoveCaretTo(textView, key, ilOffset);
         return false;
     });
 }
开发者ID:4058665,项目名称:dnSpy,代码行数:8,代码来源:DebugUtils.cs


示例12: CanShow

		public static bool CanShow(IMemberRef member) {
			var property = member as PropertyDef;
			if (property == null)
				return false;

			return !MainWindow.Instance.CurrentLanguage.ShowMember(property.GetMethod ?? property.SetMethod)
				|| AnalyzedPropertyOverridesTreeNode.CanShow(property);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:8,代码来源:AnalyzedPropertyTreeNode.cs


示例13: CanShow

        public static bool CanShow(IMemberRef member)
        {
            var eventDef = member as EventDef;
            if (eventDef == null)
                return false;

            return !MainWindow.Instance.CurrentLanguage.ShowMember(eventDef.AddMethod ?? eventDef.RemoveMethod)
                || AnalyzedEventOverridesTreeNode.CanShow(eventDef);
        }
开发者ID:gsong2014,项目名称:dnSpy,代码行数:9,代码来源:AnalyzedEventTreeNode.cs


示例14: BreakpointBookmark

 public BreakpointBookmark(IMemberRef member, TextLocation location, TextLocation endLocation, ILRange range, bool isEnabled = true)
     : base(member, range.From, location, endLocation)
 {
     var key = MethodKey.Create(member);
     Debug.Assert(key != null, "Caller must verify that MethodKey.Create() won't fail");
     this.MethodKey = key.Value;
     this.ILRange = range;
     this.isEnabled = isEnabled;
 }
开发者ID:rhowlerose,项目名称:dnSpy,代码行数:9,代码来源:BreakpointBookmark.cs


示例15: CanAnalyze

 public static bool CanAnalyze(IMemberRef member)
 {
     member = MainWindow.ResolveReference(member);
     return member is TypeDef ||
             member is FieldDef ||
             member is MethodDef ||
             AnalyzedPropertyTreeNode.CanShow(member) ||
             AnalyzedEventTreeNode.CanShow(member);
 }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:9,代码来源:AnalyzeContextMenuEntry.cs


示例16: Resolve

		static IMemberRef Resolve(IMemberRef mr) {
			if (mr is ITypeDefOrRef)
				return ((ITypeDefOrRef)mr).ResolveTypeDef();
			if (mr is IMethod && ((IMethod)mr).IsMethod)
				return ((IMethod)mr).ResolveMethodDef();
			if (mr is IField)
				return ((IField)mr).ResolveFieldDef();
			Debug.Assert(mr is PropertyDef || mr is EventDef || mr is GenericParam, "Unknown IMemberRef");
			return null;
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:10,代码来源:DnlibReferenceToolTipContentCreator.cs


示例17: JumpToReference

 public static bool JumpToReference(DecompilerTextView textView, IMemberRef mr, Func<TextLocation> getLocation)
 {
     bool retVal = MainWindow.Instance.JumpToReference(textView, mr, getLocation);
     if (!retVal) {
         MainWindow.Instance.ShowMessageBox(
             string.Format("Could not find {0}\n" +
             "Make sure that it's visible in the treeview and not a hidden method or part of a hidden class. You could also try to debug the method in IL mode.", mr));
     }
     return retVal;
 }
开发者ID:4058665,项目名称:dnSpy,代码行数:10,代码来源:DebugUtils.cs


示例18: ProcessMemberRef

		void ProcessMemberRef(ConfuserContext context, INameService service, ModuleDefMD module, IMemberRef r) {
			var memberRef = r as MemberRef;
			if (r is MethodSpec)
				memberRef = ((MethodSpec)r).Method as MemberRef;

			if (memberRef != null) {
				if (memberRef.DeclaringType.TryGetArraySig() != null)
					return;

				TypeDef declType = memberRef.DeclaringType.ResolveTypeDefThrow();
				if (declType.Module != module && context.Modules.Contains((ModuleDefMD)declType.Module)) {
					var memberDef = (IDnlibDef)declType.ResolveThrow(memberRef);
					service.AddReference(memberDef, new MemberRefReference(memberRef, memberDef));
				}
			}
		}
开发者ID:EmilZhou,项目名称:ConfuserEx,代码行数:16,代码来源:InterReferenceAnalyzer.cs


示例19: Resolve

		static IMemberDef Resolve(IMemberRef memberRef)
		{
			var member = MainWindow.ResolveReference(memberRef);
			var md = member as MethodDef;
			if (md == null)
				return member;

			if (md.SemanticsAttributes == 0)
				return member;

			// Find the property or event and return it instead

			foreach (var prop in md.DeclaringType.Properties) {
				foreach (var md2 in prop.GetMethods) {
					if (md2 == md)
						return prop;
				}
				foreach (var md2 in prop.SetMethods) {
					if (md2 == md)
						return prop;
				}
				foreach (var md2 in prop.OtherMethods) {
					if (md2 == md)
						return prop;
				}
			}

			foreach (var evt in md.DeclaringType.Events) {
				if (evt.AddMethod == md)
					return evt;
				if (evt.InvokeMethod == md)
					return evt;
				if (evt.RemoveMethod == md)
					return evt;
				foreach (var md2 in evt.OtherMethods) {
					if (md2 == md)
						return evt;
				}
			}

			// Shouldn't be here
			return member;
		}
开发者ID:nakijun,项目名称:dnSpy,代码行数:43,代码来源:SearchMsdnContextMenuEntry.cs


示例20: Analyze

 public static void Analyze(IMemberRef member)
 {
     TypeDef type = null;
     if (member is ITypeDefOrRef)
         type = ((ITypeDefOrRef)member).ResolveTypeDef();
     if (type != null)
         AnalyzerTreeView.Instance.ShowOrFocus(new AnalyzedTypeTreeNode(type));
     FieldDef field = member as FieldDef;
     if (field != null)
         AnalyzerTreeView.Instance.ShowOrFocus(new AnalyzedFieldTreeNode(field));
     MethodDef method = member as MethodDef;
     if (method != null)
         AnalyzerTreeView.Instance.ShowOrFocus(new AnalyzedMethodTreeNode(method));
     var propertyAnalyzer = AnalyzedPropertyTreeNode.TryCreateAnalyzer(member);
     if (propertyAnalyzer != null)
         AnalyzerTreeView.Instance.ShowOrFocus(propertyAnalyzer);
     var eventAnalyzer = AnalyzedEventTreeNode.TryCreateAnalyzer(member);
     if (eventAnalyzer != null)
         AnalyzerTreeView.Instance.ShowOrFocus(eventAnalyzer);
 }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:20,代码来源:AnalyzeContextMenuEntry.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMemberService类代码示例发布时间:2022-05-24
下一篇:
C# IMemberEmitter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap