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

C# DotNet.PropertyDef类代码示例

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

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



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

示例1: 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


示例2: InterfacePropertyImplementedByNode

		public InterfacePropertyImplementedByNode(PropertyDef analyzedProperty) {
			if (analyzedProperty == null)
				throw new ArgumentNullException(nameof(analyzedProperty));

			this.analyzedProperty = analyzedProperty;
			analyzedMethod = this.analyzedProperty.GetMethod ?? this.analyzedProperty.SetMethod;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:InterfacePropertyImplementedByNode.cs


示例3: AnalyzedInterfacePropertyImplementedByTreeNode

		public AnalyzedInterfacePropertyImplementedByTreeNode(PropertyDef analyzedProperty) {
			if (analyzedProperty == null)
				throw new ArgumentNullException("analyzedProperty");

			this.analyzedProperty = analyzedProperty;
			this.analyzedMethod = this.analyzedProperty.GetMethod ?? this.analyzedProperty.SetMethod;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:7,代码来源:AnalyzedInterfacePropertyImplementedByTreeNode.cs


示例4: 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


示例5: AnalyzedPropertyOverridesTreeNode

        public AnalyzedPropertyOverridesTreeNode(PropertyDef analyzedProperty)
        {
            if (analyzedProperty == null)
                throw new ArgumentNullException("analyzedProperty");

            this.analyzedProperty = analyzedProperty;
        }
开发者ID:jorik041,项目名称:dnSpy-retired,代码行数:7,代码来源:AnalyzedPropertyOverridesTreeNode.cs


示例6: DeletedPropertyUpdater

		public DeletedPropertyUpdater(ModuleDocumentNode modNode, PropertyDef originalProperty) {
			ownerNode = modNode.Context.DocumentTreeView.FindNode(originalProperty);
			if (ownerNode == null)
				throw new InvalidOperationException();
			parentNode = ownerNode.TreeNode.Parent.Data;
			ownerType = originalProperty.DeclaringType;
			property = originalProperty;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:DeletedPropertyUpdater.cs


示例7: 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


示例8: EditedPropertyUpdater

		public EditedPropertyUpdater(ModuleDocumentNode modNode, PropertyDef originalProperty, PropertyDefOptions propertyDefOptions) {
			ownerNode = modNode.Context.DocumentTreeView.FindNode(originalProperty);
			if (ownerNode == null)
				throw new InvalidOperationException();
			property = originalProperty;
			originalPropertyDefOptions = new PropertyDefOptions(originalProperty);
			newPropertyDefOptions = propertyDefOptions;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:8,代码来源:EditedPropertyUpdater.cs


示例9: GetMethodsAndSelf

		public static IEnumerable<IMemberDef> GetMethodsAndSelf(PropertyDef p) {
			yield return p;
			foreach (var m in p.GetMethods)
				yield return m;
			foreach (var m in p.SetMethods)
				yield return m;
			foreach (var m in p.OtherMethods)
				yield return m;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:DotNetUtils.cs


示例10: 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


示例11: Write

		public static ITextOutput Write(ITextOutput output, PropertyDef property, Language language, bool? isIndexer = null) {
			language.FormatPropertyName(output, property, isIndexer);
			output.WriteSpace();
			output.Write(':', TextTokenType.Operator);
			output.WriteSpace();
			language.TypeToString(output, property.PropertySig.GetRetType().ToTypeDefOrRef(), false, property);
			property.MDToken.WriteSuffixString(output);
			return output;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:9,代码来源:PropertyTreeNode.cs


示例12: PropertyDefOptions

		public PropertyDefOptions(PropertyDef prop) {
			Attributes = prop.Attributes;
			Name = prop.Name;
			PropertySig = prop.PropertySig;
			Constant = prop.Constant;
			GetMethods.AddRange(prop.GetMethods);
			SetMethods.AddRange(prop.SetMethods);
			OtherMethods.AddRange(prop.OtherMethods);
			CustomAttributes.AddRange(prop.CustomAttributes);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:10,代码来源:PropertyDefOptions.cs


示例13: PropertyDefOptions

		public PropertyDefOptions(PropertyDef prop) {
			this.Attributes = prop.Attributes;
			this.Name = prop.Name;
			this.PropertySig = prop.PropertySig;
			this.Constant = prop.Constant;
			this.GetMethods.AddRange(prop.GetMethods);
			this.SetMethods.AddRange(prop.SetMethods);
			this.OtherMethods.AddRange(prop.OtherMethods);
			this.CustomAttributes.AddRange(prop.CustomAttributes);
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:10,代码来源:PropertyDefOptions.cs


示例14: PropertyEquals

        public bool PropertyEquals(PropertyDef pd, PropertyInfo pi)
        {
            if (!MemberEquals(pd, pi) || TypeEquals(pd.PropertySig.RetType, pi.PropertyType) || (int)pd.Attributes != (int)pi.Attributes)
                return false;

            var gm = pi.GetGetMethod();
            var sm = pi.GetSetMethod();

            if (gm == null ^ pd.GetMethod == null) return false;
            if (sm == null ^ pd.SetMethod == null) return false;

            return (gm == null || MethodEquals(pd.GetMethod, gm))
                && (sm == null || MethodEquals(pd.SetMethod, sm));
        }
开发者ID:TerrariaPrismTeam,项目名称:Prism,代码行数:14,代码来源:DNReflectionComparer.cs


示例15: CopyTo

		public PropertyDef CopyTo(PropertyDef prop) {
			prop.Attributes = this.Attributes;
			prop.Name = this.Name ?? UTF8String.Empty;
			prop.PropertySig = this.PropertySig;
			prop.Constant = this.Constant;
			prop.GetMethods.Clear();
			prop.GetMethods.AddRange(this.GetMethods);
			prop.SetMethods.Clear();
			prop.SetMethods.AddRange(this.SetMethods);
			prop.OtherMethods.Clear();
			prop.OtherMethods.AddRange(this.OtherMethods);
			prop.CustomAttributes.Clear();
			prop.CustomAttributes.AddRange(CustomAttributes);
			return prop;
		}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:15,代码来源:PropertyDefOptions.cs


示例16: IsBaseProperty

		/// <summary>
		/// Determines whether a property overrides or hides another property.
		/// </summary>
		/// <param name="parentProperty">The property declared in a base type.</param>
		/// <param name="childProperty">The property declared in a derived type.</param>
		/// <returns>true if the <paramref name="childProperty"/> hides or overrides <paramref name="parentProperty"/>,
		/// otherwise false.</returns>
		public static bool IsBaseProperty(PropertyDef parentProperty, PropertyDef childProperty) {
			if (parentProperty == null)
				return false;
			if (childProperty == null)
				return false;

			if (parentProperty.Name != childProperty.Name)
				return false;

			var parentParams = parentProperty.PropertySig.GetParamCount();
			var childParams = childProperty.PropertySig.GetParamCount();
			if (parentParams > 0 || childParams > 0)
				if (parentParams == 0 || childParams == 0 || parentParams != childParams)
					return false;

			return FindBaseProperties(childProperty).Any(m => m == parentProperty);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:24,代码来源:TypesHierarchyHelpers.cs


示例17: IsBaseProperty

		/// <summary>
		/// Determines whether a property overrides or hides another property.
		/// </summary>
		/// <param name="parentProperty">The property declared in a base type.</param>
		/// <param name="childProperty">The property declared in a derived type.</param>
		/// <returns>true if the <paramref name="childProperty"/> hides or overrides <paramref name="parentProperty"/>,
		/// otherwise false.</returns>
		public static bool IsBaseProperty(PropertyDef parentProperty, PropertyDef childProperty)
		{
			if (parentProperty == null)
				throw new ArgumentNullException("parentProperty");
			if (childProperty == null)
				throw new ArgumentNullException("childProperty");

			if (parentProperty.Name != childProperty.Name)
				return false;

			var parentParams = parentProperty.PropertySig.GetParams();
			var childParams = childProperty.PropertySig.GetParams();
			if (parentParams.Count > 0 || childParams.Count > 0)
				if (parentParams.Count == 0 || childParams.Count == 0 || parentParams.Count != childParams.Count)
					return false;

			return FindBaseProperties(childProperty).Any(m => m == parentProperty);
		}
开发者ID:modulexcite,项目名称:ICSharpCode.Decompiler-retired,代码行数:25,代码来源:TypesHierarchyHelpers.cs


示例18: 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


示例19: 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


示例20: Analyze

        void Analyze(NameService service, ConfuserContext context, ProtectionParameters parameters, PropertyDef property)
        {
            if (property.DeclaringType.IsVisibleOutside() &&
                !IsVisibleOutside(context, parameters, property))
                service.SetCanRename(property, false);

            else if (property.IsRuntimeSpecialName)
                service.SetCanRename(property, false);

            else if (parameters.GetParameter(context, property, "forceRen", false))
                return;

            else if (property.DeclaringType.Implements("System.ComponentModel.INotifyPropertyChanged"))
                service.SetCanRename(property, false);

            else if (property.DeclaringType.Name.String.Contains("AnonymousType"))
                service.SetCanRename(property, false);
        }
开发者ID:huoxudong125,项目名称:ConfuserEx,代码行数:18,代码来源:AnalyzePhase.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# DotNet.TypeRef类代码示例发布时间:2022-05-26
下一篇:
C# DotNet.ModuleDefMD类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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