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


C# PropertyInfo.ToString方法代码示例

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


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

示例1: OutputSettingsException

 public OutputSettingsException(PropertyInfo setting, object reqValue, object capValue)
     : base("Failed to create output setting for '" + setting.ToString() + "'")
 {
     this.setting = setting;
     this.reqValue = reqValue;
     this.capValue = capValue;
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:OutputSettings.cs

示例2: PropertyMetadata

        internal PropertyMetadata(PropertyInfo info)
        {
            PropertyInfo = info;

            #if !DataAnnotations_Missing
            Validators = ImmutableArray.CreateRange(info.GetCustomAttributes(typeof(ValidationAttribute), true).OfType<ValidationAttribute>());
            #endif

            IsIndexed = info.GetIndexParameters().Length > 0;

            m_GetMethod = PropertyInfo.GetMethod;
            m_SetMethod = PropertyInfo.SetMethod;

            PropertyType = info.PropertyType;

            var name = info.ToString();
            Name = name.Substring(name.IndexOf(" ", StringComparison.Ordinal) + 1);

            if (IsIndexed)
                PropertyChangedEventArgs = new PropertyChangedEventArgs(info.Name + "[]");
            else
                PropertyChangedEventArgs = new PropertyChangedEventArgs(info.Name);

            #if !DataAnnotations_Missing
            IsKey = info.GetCustomAttributes(typeof(KeyAttribute), true).Any();

            var doNotMap = info.GetCustomAttributes(typeof(NotMappedAttribute), true).Any();
            if (!doNotMap)
            {
                var column = (ColumnAttribute)info.GetCustomAttributes(typeof(ColumnAttribute), true).SingleOrDefault();
                MappedColumnName = column != null ? column.Name : Name;
            }
            var decomposeAttribute = (DecomposeAttribute)(info.GetCustomAttributes(typeof(DecomposeAttribute), true).FirstOrDefault());
            if (decomposeAttribute != null)
            {
                Decompose = true;
                DecompositionPrefix = decomposeAttribute.Prefix;
            }
            IgnoreOnInsert = info.GetCustomAttributes(typeof(IgnoreOnInsertAttribute), true).Any();
            IgnoreOnUpdate = info.GetCustomAttributes(typeof(IgnoreOnUpdateAttribute), true).Any();
            #endif
        }
开发者ID:docevaad,项目名称:Anchor,代码行数:42,代码来源:PropertyMetadata.cs

示例3: ProcessSingleObject

        private void ProcessSingleObject(EntityContextInfo entityInfo, ElasticsearchCrudJsonWriter elasticsearchCrudJsonWriter, PropertyInfo prop, bool createPropertyMappings)
        {
            TraceProvider.Trace(TraceEventType.Verbose, "ElasticsearchMapping: Property is an Object: {0}", prop.ToString());
            // This is a single object and not a reference to it's parent

            if (createPropertyMappings && prop.GetValue(entityInfo.Document) == null)
            {
                prop.SetValue(entityInfo.Document,Activator.CreateInstance(prop.PropertyType));
            }
            if (prop.GetValue(entityInfo.Document) != null  && SaveChildObjectsAsWellAsParent)
            {
                var child = GetDocumentType(prop.GetValue(entityInfo.Document).GetType());
                var parent = GetDocumentType(entityInfo.EntityType);
                if (!SerializedTypes.Contains(child + parent))
                {
                    SerializedTypes.Add(parent + child);
                    if (ProcessChildDocumentsAsSeparateChildIndex)
                    {
                        ProcessSingleObjectAsChildDocument(entityInfo, elasticsearchCrudJsonWriter, prop, createPropertyMappings);
                    }
                    else
                    {
                        ProcessSingleObjectAsNestedObject(entityInfo, elasticsearchCrudJsonWriter, prop, createPropertyMappings);
                    }
                }
            }
        }
开发者ID:juninmd,项目名称:ElasticsearchCRUD,代码行数:27,代码来源:ElasticSearchMapping.cs

示例4: ValidationException

 public ValidationException(ValidationConstraint constraint, PropertyInfo prop)
     : base(prop.ToString())
 {
     ValidationConstraint = constraint;
     Property = prop;
 }
开发者ID:BackupTheBerlios,项目名称:boxerp-svn,代码行数:6,代码来源:ValidationException.cs

示例5: ProcessProperty

 void ProcessProperty(PropertyInfo propertyInfo)
 {
     Debug.WriteLine ("Add property " + propertyInfo.ToString ());
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:4,代码来源:LScript.cs

示例6: ValueToString

		public static string ValueToString( object obj, PropertyInfo prop )
		{
			try
			{
                if (prop == null)
                    return "!Null PropertyInfo!";

                if (obj == null)
                {
                    MethodInfo mi = prop.GetGetMethod(false);
                    if (mi == null) // don't expect this to *ever* get hit.. would only occur on set-only props
                        return "!Null Obj, MethodInfo!"; // or non-public ones
                    if (!mi.IsStatic)
                        return "-null-";
					// okay, wtf is going on!
					throw new ApplicationException(String.Format("{0} was null", prop.ToString()));
                }

				return ValueToString( prop.GetValue( obj, null ) );
			}
			catch ( Exception e )
			{
                LogHelper.LogException(e);
				return String.Format( "!{0}!", e.GetType() );
			}
		}
开发者ID:zerodowned,项目名称:angelisland,代码行数:26,代码来源:PropsGump.cs

示例7: CreateSetHandler

        // CreateSetDelegate
        public static SetHandler CreateSetHandler(Type type, PropertyInfo propertyInfo)
        {
            string _key = string.Format("{0}.{1}", propertyInfo.DeclaringType, propertyInfo.ToString());

            if (s_SetHandlerCache.ContainsKey(_key))
            {
                return s_SetHandlerCache[_key] as SetHandler;
            }

            MethodInfo setMethodInfo = propertyInfo.GetSetMethod(true);
            DynamicMethod dynamicSet = CreateSetDynamicMethod(type);
            ILGenerator setGenerator = dynamicSet.GetILGenerator();

            setGenerator.Emit(OpCodes.Ldarg_0);
            setGenerator.Emit(OpCodes.Ldarg_1);
            UnboxIfNeeded(setMethodInfo.GetParameters()[0].ParameterType, setGenerator);
            setGenerator.Emit(OpCodes.Call, setMethodInfo);
            setGenerator.Emit(OpCodes.Ret);

            SetHandler _newHandler =  (SetHandler)dynamicSet.CreateDelegate(typeof(SetHandler));
            s_SetHandlerCache.Add(_key, _newHandler);
            return _newHandler;
        }
开发者ID:hansuky,项目名称:Yuhan,代码行数:24,代码来源:MethodCompiler.cs


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