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


C# Field.GetType方法代码示例

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


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

示例1: FieldTypeTest

        public void FieldTypeTest()
        {
            var idField = new Field
            {
                Name = "Id"
            };
            var fieldType = idField.GetType<Person>();

            Assert.AreEqual(fieldType, typeof (int));
        }
开发者ID:smatsri,项目名称:query-builder,代码行数:10,代码来源:SqlTests.cs

示例2: CreateEntity

        private Entity CreateEntity(XmlNode node, bool hasDeletedField = false, bool checkTabularSectionKey = false)
        {
            Entity entity = new Entity(null, hasDeletedField);
            foreach (System.Xml.XmlAttribute a in node.Attributes)
            {
                System.Reflection.PropertyInfo pi = entity.GetType().GetProperty(a.Name);
                pi.SetValue(entity, System.Convert.ChangeType(a.Value, pi.PropertyType), null);
            }

            XmlNodeList fieldNodes = node.SelectNodes("Fields/Field");
            foreach (XmlNode fieldNode in fieldNodes)
            {
                Field field = new Field();
                foreach (System.Xml.XmlAttribute a in fieldNode.Attributes)
                {
                    System.Reflection.PropertyInfo pi = field.GetType().GetProperty(a.Name);
                    pi.SetValue(field, System.Convert.ChangeType(a.Value, pi.PropertyType), null);
                }
                entity.Fields.Add(field);
            }
            entity.SortFields();

            XmlNodeList tabularSectionNodes = node.SelectNodes("TabularSections/TabularSection");
            foreach (XmlNode tabularSectionNode in tabularSectionNodes)
            {
                TabularSection tabularSection = new TabularSection(entity);
                foreach (System.Xml.XmlAttribute a in tabularSectionNode.Attributes)
                {
                    System.Reflection.PropertyInfo pi = tabularSection.GetType().GetProperty(a.Name);
                    pi.SetValue(tabularSection, System.Convert.ChangeType(a.Value, pi.PropertyType), null);
                }
         
                XmlNodeList tabularSectionFieldNodes = tabularSectionNode.SelectNodes("Field");
                foreach (XmlNode tabularSectionFieldNode in tabularSectionFieldNodes)
                {
                    Field field = new Field();
                    foreach (System.Xml.XmlAttribute a in tabularSectionFieldNode.Attributes)
                    {
                        System.Reflection.PropertyInfo pi = field.GetType().GetProperty(a.Name);
                        pi.SetValue(field, System.Convert.ChangeType(a.Value, pi.PropertyType), null);
                    }
                    tabularSection.Fields.Add(field);
                }

                tabularSection.SortFields();
                entity.TabularSections.Add(tabularSection);
            }

            entity.Validate(checkTabularSectionKey);
            return entity;
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:51,代码来源:CodeFactory.cs

示例3: CreateEmptyFieldObject

		protected IStorageField CreateEmptyFieldObject(Field field)
		{
			var storageService = service.StorageService;
			return storageService.GetObjectFactory().CreateEmptyFieldObject(field.GetType());
		}
开发者ID:jango2015,项目名称:WebVella-ERP,代码行数:5,代码来源:FieldProfile.cs


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