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


C# IReflect.GetFields方法代码示例

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


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

示例1: DefaultEnvironmentProvider

 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultEnvironmentProvider"/> class.
 /// </summary>
 /// <param name="supportedType">A <see cref="IReflect"/> of a object with the supported Environment Aliases on.</param>
 protected DefaultEnvironmentProvider(IReflect supportedType)
 {
     this.SupportedAliases = supportedType
         .GetFields(BindingFlags.Static | BindingFlags.Public)
         .Where(f => f.IsLiteral)
         .Select(a => a.GetValue(supportedType) as string)
         .ToArray();
 }
开发者ID:TruffleMuffin,项目名称:Decisions,代码行数:12,代码来源:DefaultEnvironmentProvider.cs

示例2: injectMembers

		private void injectMembers(IReflect type, object instance)
		{
			var properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance)
				.Where(x => x.CanWrite);
			foreach (var propertyInfo in properties)
			{
				propertyInfo.SetValue(instance, _container.Resolve(propertyInfo.PropertyType), null);
			}
			var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
			foreach (var fieldsInfo in fields)
			{
				fieldsInfo.SetValue(instance, _container.Resolve(fieldsInfo.FieldType));
			}
		}
开发者ID:Teleopti,项目名称:Stardust,代码行数:14,代码来源:BaseTestsAttribute.cs

示例3: SetPublicFields

 private static void SetPublicFields(IReflect type, object obj, Dictionary<Type, object> createdObjectReferences)
 {
     var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
     var objectGenerator = new ObjectGenerator();
     foreach (var field in fields)
     {
         var fieldValue = objectGenerator.GenerateObject(field.FieldType, createdObjectReferences);
         field.SetValue(obj, fieldValue);
     }
 }
开发者ID:ouyh18,项目名称:LtePlatform,代码行数:10,代码来源:ObjectGenerator.cs

示例4: GetConstants

		private static IEnumerable<string> GetConstants(IReflect myType, BindingFlags flags)
		{
			var fields = myType.GetFields(flags);
			foreach (var fieldInfo in fields)
			{
				var type = ToPrettyString(fieldInfo.FieldType);
				if (!returnTypeDictionary.ContainsKey(type))
					returnTypeDictionary[type] = new List<string>();
				returnTypeDictionary[type].Add(fieldInfo.Name);
			}
			return fields.Select(x => x.Name).Distinct();
		}
开发者ID:andgein,项目名称:uLearn,代码行数:12,代码来源:CsCompleterGenerator.cs

示例5: FindLocalizationFields

 public static IEnumerable<FieldInfo> FindLocalizationFields(IReflect type)
 {
     return from field in type.GetFields(BindingFlags.Static | BindingFlags.Public)
            where GetLocalizationAttribute(field) != null
            select field;
 }
开发者ID:KalleMarSolita,项目名称:episerver-localization-editor,代码行数:6,代码来源:LocalizationAttributeHelpers.cs

示例6: GetFields

 private IEnumerable<MemberInfo> GetFields(IReflect type)
 {
     return type
         .GetFields(DefaultMembersSearchFlags)
         .Where(x => !x.IsDefined(typeof(NonSerializedAttribute), false));
 }
开发者ID:anthony-martin,项目名称:Triangles-in-space,代码行数:6,代码来源:FieldContractResolver.cs

示例7: GetFields

 private static IEnumerable<FieldInfo> GetFields(IReflect type)
 {
     return type.GetFields(Flags);
 }
开发者ID:Tdue21,项目名称:teamcitycsharprunner,代码行数:4,代码来源:AbstractObjectVisitor.cs

示例8: FieldInfoCache

 private FieldInfoCache(IReflect type)
 {
     Fields = type.GetFields(SimpleReflection.BindingFlags);
     _fields = Fields.ToDictionary(x => x.Name, StringComparer.Ordinal);
 }
开发者ID:respu,项目名称:SimplyFast,代码行数:5,代码来源:FieldInfoCache.cs


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