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


C# IMemberRef类代码示例

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


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


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