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

C# PropertyDefinition类代码示例

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

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



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

示例1: Read

 public void Read(ClrModuleReader reader)
 {
     this.PropertyDefinition = new PropertyDefinition();
     this.PropertyDefinition.Attributes = (PropertyAttributes)reader.Binary.ReadUInt16();
     this.PropertyDefinition.Name = reader.ReadString();
     this.Type = reader.ReadPropertySignature();
 }
开发者ID:BGCX261,项目名称:zoompe-git,代码行数:7,代码来源:PropertyEntry.cs


示例2: GetPropertyTags

 private static IEnumerable<string> GetPropertyTags(ContentData content, PropertyDefinition propertyDefinition)
 {
     var tagNames = content[propertyDefinition.Name] as string;
     return tagNames == null
         ? Enumerable.Empty<string>()
         : tagNames.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
 }
开发者ID:Sebbe,项目名称:Tags,代码行数:7,代码来源:TagsModule.cs


示例3: AssignToProperty

 public override void AssignToProperty(object obj, PropertyDefinition property)
 {
     if (property.CanSet)
         property.SetOn(obj, GetTypedValue(collectionDef));
     else if (property.CanGet)
         PopulateCollection(collectionDef, property.GetFrom(obj));
 }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:7,代码来源:CollectionSequence.cs


示例4: DoPropertyBind

            private void DoPropertyBind(PropertyTreeBinderImpl parent,
                                        PropertyTreeMetaObject target,
                                        PropertyTreeNavigator navigator,
                                        PropertyDefinition property)
            {
                object ancestor = null;
                PropertyTreeMetaObject ancestorMeta = null;

                if (property.IsExtender) {
                    var ancestorType = property.DeclaringTreeDefinition.SourceClrType;
                    ancestorMeta = target.GetAncestors().Cast<PropertyTreeMetaObject>().FirstOrDefault(
                        t => ancestorType.IsAssignableFrom(t.ComponentType));

                    if (ancestorMeta != null)
                        ancestor = ancestorMeta.Component;
                }

                var component = target.Component;
                PropertyTreeMetaObject propertyTarget = target.CreateChild(property, navigator.QualifiedName, ancestorMeta);

                var services = new PropertyBindContext(
                    component,
                    property,
                    ServiceProvider.Compose(ServiceProvider.FromValue(navigator), parent))
                {
                    LineNumber = navigator.LineNumber,
                    LinePosition = navigator.LinePosition,
                };

                propertyTarget = parent.Bind(propertyTarget, navigator, services);
                target.BindSetMember(property, navigator.QualifiedName, propertyTarget, ancestorMeta, services);
            }
开发者ID:Carbonfrost,项目名称:ff-property-trees,代码行数:32,代码来源:ProcessPropertiesStep.cs


示例5: PropertyMapDefinition

 public PropertyMapDefinition()
 {
     this.Source = new ObjectDefinition();
     this.Target = new ObjectDefinition();
     this.SourceProp = new PropertyDefinition();
     this.TargetProp = new PropertyDefinition();
 }
开发者ID:Joebeazelman,项目名称:rebelcmsxu5,代码行数:7,代码来源:PropertyMapDefinition.cs


示例6: RequiredRule

        public RequiredRule(PropertyDefinition propertyDefinition)
            : base(propertyDefinition)
        {
            base.Assertion = oi => !String.IsNullOrWhiteSpace(oi.GetUntypedValue(propertyDefinition).StringValue);

              base.ErrorMessageStaticGenerator = () => $"'{propertyDefinition.CurrentName}' is required.";
        }
开发者ID:principle4,项目名称:DryLogic,代码行数:7,代码来源:RequiredRule.cs


示例7: CreateProperty

		static PropertyDefinition CreateProperty()
		{
			var prop = new PropertyDefinition(Generate.Name.ForMethod(), PropertyAttributes.None, TestModule.TypeSystem.Boolean);
			TestType.Properties.Add(prop);
			prop.DeclaringType = TestType;
			return prop;
		}
开发者ID:mwoelk83,项目名称:Mono.Cecil.Fluent,代码行数:7,代码来源:UnsetAttributes.cs


示例8: GetObservableFromProperty

 private IObservable<object> GetObservableFromProperty(PropertyDefinition subscription)
 {
     return Observable.FromEventPattern<PropertyChangedEventHandler, PropertyChangedEventArgs>(
         parentOnPropertyChanged => subscription.Parent.PropertyChanged += parentOnPropertyChanged,
         parentOnPropertyChanged => subscription.Parent.PropertyChanged -= parentOnPropertyChanged)
         .Where(pattern => pattern.EventArgs.PropertyName == subscription.PropertyName)
         .Select(pattern => _mountPoint.Value);
 }
开发者ID:healtech,项目名称:Perspex,代码行数:8,代码来源:ObservablePropertyBranch.cs


示例9: PropertyBasedScheduleConditionDefinition

        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyBasedScheduleConditionDefinition"/> class.
        /// </summary>
        /// <param name="contractName">The contract name that is used to identify the current condition.</param>
        /// <param name="property">The property that will provide the condition result.</param>
        private PropertyBasedScheduleConditionDefinition(string contractName, PropertyDefinition property)
            : base(contractName)
        {
            {
                Debug.Assert(property != null, "The property object should not be null.");
            }

            m_Property = property;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:14,代码来源:PropertyBasedScheduleConditionDefinition.cs


示例10: CreateTextBlockControl

        /// <summary>
        /// Creates the text block control.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <returns>
        /// 
        /// </returns>
        protected virtual FrameworkElement CreateTextBlockControl(PropertyDefinition property)
        {
            var tb = new TextBlock
                {
                    HorizontalAlignment = property.HorizontalAlignment,
                    VerticalAlignment = VerticalAlignment.Center,
                    Padding = new Thickness(4, 0, 4, 0)
                };

            tb.SetBinding(TextBlock.TextProperty, property.CreateOneWayBinding());
            return tb;
        }
开发者ID:yovannyr,项目名称:PropertyTools,代码行数:19,代码来源:ItemsGridControlFactory.cs


示例11: PropertyBasedExportDefinition

        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyBasedExportDefinition"/> class.
        /// </summary>
        /// <param name="contractName">The contract name that is used to identify the current export.</param>
        /// <param name="declaringType">The type that declares the property on which the import is placed.</param>
        /// <param name="property">The property for which the current object stores the serialized data.</param>
        private PropertyBasedExportDefinition(
            string contractName,
            TypeIdentity declaringType,
            PropertyDefinition property)
            : base(contractName, declaringType)
        {
            {
                Debug.Assert(property != null, "The property object shouldn't be null.");
            }

            m_Property = property;
        }
开发者ID:pvandervelde,项目名称:Apollo,代码行数:18,代码来源:PropertyBasedExportDefinition.cs


示例12: CreateEditControl

        public override FrameworkElement CreateEditControl(PropertyDefinition propertyDefinition, string bindingPath)
        {
            var control = propertyDefinition.CreateEditControl(bindingPath);
            if (control != null)
                return control;

            var ctl = CreateExtendedToolkitControl(propertyDefinition, bindingPath);
            if (ctl != null)
                return ctl;

            return base.CreateEditControl(propertyDefinition, bindingPath);
        }
开发者ID:yovannyr,项目名称:PropertyTools,代码行数:12,代码来源:ExtendedToolkitDataGridControlFactory.cs


示例13: AssignToProperty

 public override void AssignToProperty(object obj, PropertyDefinition property)
 {
     if (property.CanSet)
     {
         property.SetOn(obj, GetTypedValue());
     }
     else if (property.CanGet)
     {
         typedDictionary = property.GetFrom(obj) as IDictionary;
         PopulateDictionary();
     }
 }
开发者ID:soxtoby,项目名称:ForSerial,代码行数:12,代码来源:DictionaryStructure.cs


示例14: TypeConvertableRule

        public TypeConvertableRule(PropertyDefinition propertyDefinition)
            : base(propertyDefinition)
        {
            base.Assertion = oi =>
              {
            var propertyValue = oi.GetUntypedValue(propertyDefinition);
            //a type is converted at the time it's string value is set, so all we need to do is check to see if that was successful.
            return propertyValue.TypedValueIsAvailable;
              };

              base.ErrorMessageStaticGenerator = () =>
            $"{propertyDefinition.CurrentName} must be a valid {(App.CurrentContext.IsHumanInterface ? GetHumanNameForType(propertyDefinition.ValueType) : propertyDefinition.ValueType.ToString())}.";
        }
开发者ID:principle4,项目名称:DryLogic,代码行数:13,代码来源:TypeConvertableRule.cs


示例15: CreateEditControl

        /// <summary>
        /// Creates the edit control.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="instance">The instance.</param>
        /// <returns>
        /// The control.
        /// </returns>
        public virtual FrameworkElement CreateEditControl(PropertyDefinition property, object instance)
        {
            var propertyType = property.Descriptor.PropertyType;
            if (property.ItemsSourceProperty != null || property.ItemsSource != null)
                return CreateComboBox(property);

            if (propertyType.Is(typeof(Color)))
            {
                return this.CreateColorPickerControl(property);
            }

            return CreateTextBox(property);
        }
开发者ID:vitaliygor,项目名称:Well,代码行数:21,代码来源:ItemsGridControlFactory.cs


示例16: CreateProperty

        static PropertyDefinition CreateProperty()
		{
			var prop = new PropertyDefinition(Generate.Name.ForMethod(), PropertyAttributes.None, TestModule.TypeSystem.Boolean);
			TestType.Properties.Add(prop);
			prop.DeclaringType = TestType;
			prop.GetMethod = TestType.CreateMethod("get_" + prop.Name)
				.Returns<bool>()
                .AppendIL()
				    .Ldc(true)
				    .Ret()
				    .MethodDefinition;
			return prop;
		}
开发者ID:mwoelk83,项目名称:Mono.Cecil.Fluent,代码行数:13,代码来源:Property.cs


示例17: Create

 internal static CilProperty Create(PropertyDefinition propertyDef, int token, ref CilReaders readers, CilTypeDefinition typeDefinition)
 {
     CilProperty property = new CilProperty();
     property._typeDefinition = typeDefinition;
     property._propertyDef = propertyDef;
     property._readers = readers;
     property._isSignatureInitialized = false;
     property._isDefaultValueInitialized = false;
     property._isGetterInitialized = false;
     property._isSetterInitialized = false;
     property._token = token;
     property._accessors = propertyDef.GetAccessors();
     return property;
 }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:14,代码来源:CilProperty.cs


示例18: CreateDisplayControl

        /// <summary>
        /// Creates the display control.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="instance">The instance.</param>
        /// <returns>
        /// The control.
        /// </returns>
        public virtual FrameworkElement CreateDisplayControl(PropertyDefinition property, object instance)
        {
            var propertyType = property.Descriptor.PropertyType;
            if (propertyType.Is(typeof(bool)))
            {
                return this.CreateCheckBoxControl(property);
            }

            if (propertyType.Is(typeof(Color)))
            {
                return this.CreateColorPreviewControl(property);
            }

            return this.CreateTextBlockControl(property);
        }
开发者ID:vitaliygor,项目名称:Well,代码行数:23,代码来源:ItemsGridControlFactory.cs


示例19: InvalidStringRule

        public InvalidStringRule(PropertyDefinition propertyDefinition, params string[] invalidStrings)
            : base(propertyDefinition)
        {
            InvalidStrings = invalidStrings;

              base.Assertion = oi =>
              {
            var stringValue = oi.GetUntypedValue(propertyDefinition).StringValue;
            if (stringValue == null)
            {
              return true;
            }
            return !InvalidStrings.Any(ic => stringValue.Contains(ic));
              };

              base.ErrorMessageStaticGenerator = () => $"'{propertyDefinition.CurrentName}' cannot contain any of the following values {string.Join(",", InvalidStrings)}.";
        }
开发者ID:principle4,项目名称:DryLogic,代码行数:17,代码来源:InvalidStringsRule.cs


示例20: RangeRule

        public RangeRule(PropertyDefinition propertyDefinition, object minValue, object maxValue)
            : base(propertyDefinition)
        {
            MinimumValue = minValue;
              MaximumValue = maxValue;

              base.Assertion = oi =>
              {
            var stringValue = oi.GetUntypedValue(propertyDefinition).StringValue;
            if (stringValue == null)
            {
              return true;
            }

            Type propertyType = propertyDefinition.ValueType;
            object min;
            object max;

            try
            {
              min = Convert.ChangeType(MinimumValue, propertyType);
              max = Convert.ChangeType(MaximumValue, propertyType);
            }
            catch (InvalidCastException cx)
            {
              return false;
            }

            var objValue = oi.GetUntypedValue(propertyDefinition).Value;
            if (propertyType == typeof(int))
            {
              return (int)objValue >= (int)minValue && (int)objValue <= (int)maxValue;
            }
            if (propertyType == typeof(double) || propertyType == typeof(float))
            {
              return (double)objValue >= (double)minValue && (double)objValue <= (double)maxValue;
            }
            if (propertyType == typeof(DateTime) || propertyType == typeof(DateTime))
            {
              return (DateTime)objValue >= (DateTime)minValue && (DateTime)objValue <= (DateTime)maxValue;
            }
            throw new InvalidOperationException("Range type must be one of the following types: int, float, double, DateTime");
              };

              base.ErrorMessageStaticGenerator = () => $"'{propertyDefinition.CurrentName}' must be between {MinimumValue} and {MaximumValue}.";
        }
开发者ID:principle4,项目名称:DryLogic,代码行数:46,代码来源:RangeRule.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# PropertyDescriptor类代码示例发布时间:2022-05-24
下一篇:
C# PropertyDeclaration类代码示例发布时间: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