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


C# PropertyDef.IsIndexer方法代码示例

本文整理汇总了C#中dnlib.DotNet.PropertyDef.IsIndexer方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyDef.IsIndexer方法的具体用法?C# PropertyDef.IsIndexer怎么用?C# PropertyDef.IsIndexer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dnlib.DotNet.PropertyDef的用法示例。


在下文中一共展示了PropertyDef.IsIndexer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PropertyNode

		public PropertyNode(PropertyDef analyzedProperty, bool hidesParent = false) {
			if (analyzedProperty == null)
				throw new ArgumentNullException(nameof(analyzedProperty));
			isIndexer = analyzedProperty.IsIndexer();
			this.analyzedProperty = analyzedProperty;
			this.hidesParent = hidesParent;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:PropertyNode.cs

示例2: AnalyzedPropertyTreeNode

		public AnalyzedPropertyTreeNode(PropertyDef analyzedProperty, bool hidesParent = false) {
			if (analyzedProperty == null)
				throw new ArgumentNullException("analyzedProperty");
			this.isIndexer = analyzedProperty.IsIndexer();
			this.analyzedProperty = analyzedProperty;
			this.hidesParent = hidesParent;
			this.LazyLoading = true;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:8,代码来源:AnalyzedPropertyTreeNode.cs

示例3: AnalyzedPropertyTreeNode

 public AnalyzedPropertyTreeNode(PropertyDef analyzedProperty, string prefix = "")
 {
     if (analyzedProperty == null)
         throw new ArgumentNullException("analyzedProperty");
     this.isIndexer = analyzedProperty.IsIndexer();
     this.analyzedProperty = analyzedProperty;
     this.prefix = prefix;
     this.LazyLoading = true;
 }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:9,代码来源:AnalyzedPropertyTreeNode.cs

示例4: PropertyTreeNode

        public PropertyTreeNode(PropertyDef property)
        {
            if (property == null)
                throw new ArgumentNullException("property");
            this.property = property;
            using (LoadedAssembly.DisableAssemblyLoad()) {
                this.isIndexer = property.IsIndexer();
            }

            if (property.GetMethod != null)
                this.Children.Add(new MethodTreeNode(property.GetMethod));
            if (property.SetMethod != null)
                this.Children.Add(new MethodTreeNode(property.SetMethod));
            if (property.HasOtherMethods) {
                foreach (var m in property.OtherMethods)
                    this.Children.Add(new MethodTreeNode(m));
            }
        }
开发者ID:BahNahNah,项目名称:dnSpy,代码行数:18,代码来源:PropertyTreeNode.cs

示例5: PropertyTreeNode

		public PropertyTreeNode(PropertyDef property, ILSpyTreeNode owner) {
			if (property == null)
				throw new ArgumentNullException("property");
			this.property = property;
			var list = GetDnSpyFileList(owner ?? this);
			using (list == null ? null : list.DisableAssemblyLoad()) {
				this.isIndexer = property.IsIndexer();
			}

			if (property.GetMethod != null)
				this.Children.Add(new MethodTreeNode(property.GetMethod));
			if (property.SetMethod != null)
				this.Children.Add(new MethodTreeNode(property.SetMethod));
			if (property.HasOtherMethods) {
				foreach (var m in property.OtherMethods)
					this.Children.Add(new MethodTreeNode(m));
			}

		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:19,代码来源:PropertyTreeNode.cs

示例6: FindBaseProperties

        /// <summary>
        /// Finds all properties from base types overridden or hidden by the specified property.
        /// </summary>
        /// <param name="property">The property which overrides or hides properties from base types.</param>
        /// <returns>Properties overriden or hidden by the specified property.</returns>
        public static IEnumerable<PropertyDef> FindBaseProperties(PropertyDef property)
        {
            if (property == null)
                yield break;

            var accMeth = property.GetMethod ?? property.SetMethod;
            if (accMeth != null && accMeth.HasOverrides)
                yield break;

            bool isIndexer = property.IsIndexer();

            foreach (var baseType in BaseTypes(property.DeclaringType)) {
                var baseTypeDef = baseType.Resolve();
                if (baseTypeDef == null)
                    continue;
                foreach (var baseProperty in baseTypeDef.Properties) {
                    if (MatchProperty(baseProperty, Resolve(baseProperty.PropertySig, baseType), property)
                            && IsVisibleFromDerived(baseProperty, property.DeclaringType)) {
                        if (isIndexer != baseProperty.IsIndexer())
                            continue;
                        yield return baseProperty;
                        var anyPropertyAccessor = baseProperty.GetMethod ?? baseProperty.SetMethod;
                        if (anyPropertyAccessor != null && anyPropertyAccessor.IsNewSlot == anyPropertyAccessor.IsVirtual)
                            yield break;
                    }
                }
            }
        }
开发者ID:lovebanyi,项目名称:dnSpy,代码行数:33,代码来源:TypesHierarchyHelpers.cs

示例7: FormatPropertyName

        public override string FormatPropertyName(PropertyDef property, bool? isIndexer)
        {
            if (property == null)
                throw new ArgumentNullException("property");

            if (!isIndexer.HasValue) {
                isIndexer = property.IsIndexer();
            }
            if (isIndexer.Value) {
                var buffer = new System.Text.StringBuilder();
                var accessor = property.GetMethod ?? property.SetMethod;
                if (accessor.HasOverrides) {
                    var declaringType = accessor.Overrides.First().MethodDeclaration.DeclaringType;
                    buffer.Append(TypeToString(declaringType, includeNamespace: true));
                    buffer.Append(@".");
                }
                buffer.Append(@"this[");
                bool addSeparator = false;
                foreach (var p in property.PropertySig.GetParameters()) {
                    if (addSeparator)
                        buffer.Append(@", ");
                    else
                        addSeparator = true;
                    buffer.Append(TypeToString(p.ToTypeDefOrRef(), includeNamespace: true));
                }
                buffer.Append(@"]");
                return buffer.ToString();
            } else
                return property.Name;
        }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:30,代码来源:CSharpLanguage.cs

示例8: WriteToolTip

        void WriteToolTip(ITextOutput output, PropertyDef prop)
        {
            var sig = prop.PropertySig;
            var md = prop.GetMethods.FirstOrDefault() ??
                    prop.SetMethods.FirstOrDefault() ??
                    prop.OtherMethods.FirstOrDefault();

            var writer = new MethodWriter(this, output, md);
            writer.WriteReturnType();
            WriteToolTip(output, prop.DeclaringType);
            output.Write('.', TextTokenType.Operator);
            var ovrMeth = md == null || md.Overrides.Count == 0 ? null : md.Overrides[0].MethodDeclaration;
            if (prop.IsIndexer()) {
                if (ovrMeth != null) {
                    WriteToolTipType(output, ovrMeth.DeclaringType, false);
                    output.Write('.', TextTokenType.Operator);
                }
                output.Write("this", TextTokenType.Keyword);
                writer.WriteGenericArguments();
                writer.WriteMethodParameterList('[', ']');
            }
            else if (ovrMeth != null && GetPropName(ovrMeth) != null) {
                WriteToolTipType(output, ovrMeth.DeclaringType, false);
                output.Write('.', TextTokenType.Operator);
                output.Write(IdentifierEscaper.Escape(GetPropName(ovrMeth)), TextTokenHelper.GetTextTokenType(prop));
            }
            else
                output.Write(IdentifierEscaper.Escape(prop.Name), TextTokenHelper.GetTextTokenType(prop));

            output.WriteSpace();
            output.WriteLeftBrace();
            if (prop.GetMethods.Count > 0) {
                output.WriteSpace();
                output.Write("get", TextTokenType.Keyword);
                output.Write(';', TextTokenType.Operator);
            }
            if (prop.SetMethods.Count > 0) {
                output.WriteSpace();
                output.Write("set", TextTokenType.Keyword);
                output.Write(';', TextTokenType.Operator);
            }
            output.WriteSpace();
            output.WriteRightBrace();
        }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:44,代码来源:CSharpLanguage.cs

示例9: FormatPropertyName

        public override void FormatPropertyName(ITextOutput output, PropertyDef property, bool? isIndexer)
        {
            if (property == null)
                throw new ArgumentNullException("property");

            if (!isIndexer.HasValue) {
                isIndexer = property.IsIndexer();
            }
            if (isIndexer.Value) {
                var accessor = property.GetMethod ?? property.SetMethod;
                if (accessor != null && accessor.HasOverrides) {
                    var methDecl = accessor.Overrides.First().MethodDeclaration;
                    var declaringType = methDecl == null ? null : methDecl.DeclaringType;
                    TypeToString(output, declaringType, includeNamespace: true);
                    output.Write('.', TextTokenType.Operator);
                }
                output.Write("this", TextTokenType.Keyword);
                output.Write('[', TextTokenType.Operator);
                bool addSeparator = false;
                foreach (var p in property.PropertySig.GetParameters()) {
                    if (addSeparator) {
                        output.Write(',', TextTokenType.Operator);
                        output.WriteSpace();
                    }
                    else
                        addSeparator = true;
                    TypeToString(output, p.ToTypeDefOrRef(), includeNamespace: true);
                }
                output.Write(']', TextTokenType.Operator);
            } else
                output.Write(IdentifierEscaper.Escape(property.Name), TextTokenHelper.GetTextTokenType(property));
        }
开发者ID:se7ensoft,项目名称:dnSpy,代码行数:32,代码来源:CSharpLanguage.cs

示例10: Write

		void Write(PropertyDef prop) {
			if (prop == null) {
				WriteError();
				return;
			}

			var getMethod = prop.GetMethods.FirstOrDefault();
			var setMethod = prop.SetMethods.FirstOrDefault();
			var md = getMethod ?? setMethod;
			if (md == null) {
				WriteError();
				return;
			}

			var info = new MethodInfo(md, md == setMethod);
			WriteModuleName(info);
			WriteReturnType(info);
			if (ShowOwnerTypes) {
				Write(prop.DeclaringType);
				OutputWrite(".", TextTokenKind.Operator);
			}
			var ovrMeth = md == null || md.Overrides.Count == 0 ? null : md.Overrides[0].MethodDeclaration;
			if (prop.IsIndexer()) {
				if (ovrMeth != null) {
					WriteType(ovrMeth.DeclaringType, false, ShowTypeKeywords);
					OutputWrite(".", TextTokenKind.Operator);
				}
				OutputWrite("this", TextTokenKind.Keyword);
				WriteGenericArguments(info);
				WriteMethodParameterList(info, "[", "]");
			}
			else if (ovrMeth != null && GetPropName(ovrMeth) != null) {
				WriteType(ovrMeth.DeclaringType, false, ShowTypeKeywords);
				OutputWrite(".", TextTokenKind.Operator);
				WriteIdentifier(GetPropName(ovrMeth), TextTokenKindUtils.GetTextTokenType(prop));
			}
			else
				WriteIdentifier(prop.Name, TextTokenKindUtils.GetTextTokenType(prop));
			WriteToken(prop);

			WriteSpace();
			OutputWrite("{", TextTokenKind.Operator);
			if (prop.GetMethods.Count > 0) {
				WriteSpace();
				OutputWrite("get", TextTokenKind.Keyword);
				OutputWrite(";", TextTokenKind.Operator);
			}
			if (prop.SetMethods.Count > 0) {
				WriteSpace();
				OutputWrite("set", TextTokenKind.Keyword);
				OutputWrite(";", TextTokenKind.Operator);
			}
			WriteSpace();
			OutputWrite("}", TextTokenKind.Operator);
		}
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:55,代码来源:SimpleCSharpPrinter.cs

示例11: FormatPropertyName

		protected override void FormatPropertyName(IDecompilerOutput output, PropertyDef property, bool? isIndexer) {
			if (property == null)
				throw new ArgumentNullException(nameof(property));

			if (!isIndexer.HasValue) {
				isIndexer = property.IsIndexer();
			}
			if (isIndexer.Value) {
				var accessor = property.GetMethod ?? property.SetMethod;
				if (accessor != null && accessor.HasOverrides) {
					var methDecl = accessor.Overrides.First().MethodDeclaration;
					var declaringType = methDecl == null ? null : methDecl.DeclaringType;
					TypeToString(output, declaringType, includeNamespace: true);
					output.Write(".", BoxedTextColor.Operator);
				}
				output.Write("this", BoxedTextColor.Keyword);
				output.Write("[", BoxedTextColor.Punctuation);
				bool addSeparator = false;
				foreach (var p in property.PropertySig.GetParams()) {
					if (addSeparator) {
						output.Write(",", BoxedTextColor.Punctuation);
						output.Write(" ", BoxedTextColor.Text);
					}
					else
						addSeparator = true;
					TypeToString(output, p.ToTypeDefOrRef(), includeNamespace: true);
				}
				output.Write("]", BoxedTextColor.Punctuation);
			}
			else
				WriteIdentifier(output, property.Name, MetadataTextColorProvider.GetColor(property));
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:32,代码来源:CSharpDecompiler.cs


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