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


C# Item.GetType方法代码示例

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


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

示例1: Extracting

        public override void Extracting(Item item) {

            if (item.GetType() == typeof(ContentPropertyData)) {
                ContentPropertyData cpd = (ContentPropertyData)item;

                foreach (var prop in cpd.Data.Where(x => x.Value != null && macroDataTypes.Contains(x.DataTypeEditor.ToString().ToLower()))) {

                    string templateText = prop.Value.ToString();
                    
                    Helpers.MacroResolver resolver = new Helpers.MacroResolver();
                    resolver.RegisterMacroDependencies = true;
                    resolver.RegisterNodeDependencies = true;
                    resolver.context = this.ExecutionContext;

                    if (templateText.IndexOf("umbraco:macro", StringComparison.OrdinalIgnoreCase) > 0)
                        templateText = resolver.ReplaceMacroElements(templateText, false, item);

                    if (templateText.IndexOf("UMBRACO_MACRO", StringComparison.OrdinalIgnoreCase) > 0)
                        templateText = resolver.ReplaceOldMacroElements(templateText, false, item);

                    prop.Value = templateText;
                }

            }
        }
开发者ID:jayvin,项目名称:Courier,代码行数:25,代码来源:MacroParameters.cs

示例2: ApplyTest_Four

 public void ApplyTest_Four()
 {
     AbstractItem item = new Item(Category.MEDICAL, true, 11.28m);
     Type resultType = typeof(ImportedItem);
     item = rule.Apply(item);
     Assert.IsNotNull(item);
     Assert.AreEqual(resultType, item.GetType());
 }
开发者ID:linzhixiong,项目名称:.net,代码行数:8,代码来源:TaxedRuleTest.cs

示例3: ApplyTest_Two

 public void ApplyTest_Two()
 {
     AbstractItem item = new Item(Category.OTHERS, false, 11.28m);
     Type resultType = typeof(TaxedItem);
     item = rule.Apply(item);
     Assert.IsNotNull(item);
     Assert.AreEqual(resultType, item.GetType());
 }
开发者ID:linzhixiong,项目名称:.net,代码行数:8,代码来源:TaxedRuleTest.cs

示例4: ExceptionThrownInMethodEmergesIntact

        public void ExceptionThrownInMethodEmergesIntact()
        {
            //Arrange
            var item = new Item();
            var method = item.GetType().GetMethod("ThrowMethod");

            //Act
            MethodInvoker.Invoke(method, item, new object[] { 55, "bob" });
        }
开发者ID:jamie-davis,项目名称:ConsoleTools,代码行数:9,代码来源:MethodInvoker.cs

示例5: Packaging

 public override void Packaging(Item item)
 {
     if (item.GetType() == typeof(ContentPropertyData)) {
         ContentPropertyData cpd = (ContentPropertyData)item;
         foreach (var prop in cpd.Data.Where(x => x.Value != null && macroDataTypes.Contains(x.DataTypeEditor.ToString().ToLower()))) {
             FindResoucesInString(prop.Value.ToString(), item);
         }
     }
 }
开发者ID:jayvin,项目名称:Courier,代码行数:9,代码来源:Images.cs

示例6: ShouldExecute

 public override bool ShouldExecute(Item item, Core.Enums.ItemEvent itemEvent)
 {
     if (item.GetType() == typeof(ContentPropertyData)) {
         ContentPropertyData cpd = (ContentPropertyData)item;
         foreach (var cp in cpd.Data)
             if (cp.Value != null && macroDataTypes.Contains(cp.DataTypeEditor.ToString().ToLower()))
                 return true;
     }
     return false;
 }
开发者ID:jayvin,项目名称:Courier,代码行数:10,代码来源:Images.cs

示例7: PlayAction

        public override bool PlayAction(Item item)
        {
            var chapterItem = item as ChapterItem;
            if (chapterItem == null)
            {
                Logging.Logger.ReportError("Attempt to play invaild chapter item {0}", item.GetType().Name);
                return false;
            }

            Application.CurrentInstance.Play(chapterItem.ParentItem, PositionTicks);
            return true;
        }
开发者ID:bartonnen,项目名称:MediaBrowser.Classic,代码行数:12,代码来源:Chapter.cs

示例8: VoidMethodCanBeCalled

        public void VoidMethodCanBeCalled()
        {
            //Arrange
            var item = new Item();
            var method = item.GetType().GetMethod("VoidMethod");

            //Act
            MethodInvoker.Invoke(method, item, new object[] { 55, "bob" });

            //Assert
            //We expect no assertion
        }
开发者ID:jamie-davis,项目名称:ConsoleTools,代码行数:12,代码来源:MethodInvoker.cs

示例9: StaticMethodCanBeCalled

        public void StaticMethodCanBeCalled()
        {
            //Arrange
            var item = new Item();
            var method = item.GetType().GetMethod("StaticStringMethod", BindingFlags.Static | BindingFlags.Public);

            //Act
            MethodInvoker.Invoke(method, null, new object[] { 55, "bob" });

            //Assert
            //We expect no assertion
        }
开发者ID:jamie-davis,项目名称:ConsoleTools,代码行数:12,代码来源:MethodInvoker.cs

示例10: NoParamMethodCanBeCalledWithNoParameterArray

        public void NoParamMethodCanBeCalledWithNoParameterArray()
        {
            //Arrange
            var item = new Item();
            var method = item.GetType().GetMethod("NoParamMethod");

            //Act
            var result = MethodInvoker.Invoke(method, item, null) as string;

            //Assert
            Assert.That(result, Is.EqualTo("No params"));
        }
开发者ID:jamie-davis,项目名称:ConsoleTools,代码行数:12,代码来源:MethodInvoker.cs

示例11: MemberMethodCanBeCalled

        public void MemberMethodCanBeCalled()
        {
            //Arrange
            var item = new Item();
            var method = item.GetType().GetMethod("StringMethod");

            //Act
            var result = MethodInvoker.Invoke(method, item, new object[] { 55, "bob" }) as string;

            //Assert
            Assert.That(result, Is.EqualTo(item.StringMethod(55, "bob")));
        }
开发者ID:jamie-davis,项目名称:ConsoleTools,代码行数:12,代码来源:MethodInvoker.cs

示例12: CopyProperties

		private static void CopyProperties ( Item dest, Item src )
		{
			PropertyInfo[] props = src.GetType().GetProperties();

			for ( int i = 0; i < props.Length; i++ )
			{
				try
				{
					if ( props[i].CanRead && props[i].CanWrite )
						props[i].SetValue( dest, props[i].GetValue( src, null ), null );
				}
				catch
				{
				}
			}
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:16,代码来源:CloneMe.cs

示例13: Extracting

        public override void Extracting(Item item)
        {
            if (item != null)
            {
                var type = item.GetType();

                if (type == typeof(ContentPropertyData))
                {
                    var propertyData = (ContentPropertyData)item;
                    foreach (var property in propertyData.Data.Where(x => DataTypeIds.Contains(x.DataTypeEditor)))
                    {
                        if (property != null && property.Value != null)
                            ExtractingProperty(item, property);
                    }
                }
                else
                {
                    ExtractingDataType((DataType)item);
                }
            }
        }
开发者ID:jayvin,项目名称:Courier,代码行数:21,代码来源:MultiPropertyDataResolverProvider.cs

示例14: Packaging

        public override void Packaging(Item item)
        {
            if (item != null)
            {
                var type = item.GetType();

                if (type == typeof(ContentPropertyData))
                {
                    var propertyData = (ContentPropertyData)item;
                    foreach (var property in propertyData.Data.Where(x => x.DataTypeEditor == DataTypeId))
                    {
                        if (property != null && property.Value != null)
                            PackagingProperty(item, property);
                    }
                }
                else
                {
                    PackagingDataType((DataType)item);
                }
            }
        }
开发者ID:jayvin,项目名称:Courier,代码行数:21,代码来源:PropertyDataResolverProvider.cs

示例15: WriteItem

 public void WriteItem(StreamWriter op, Item it)
 {
     op.WriteLine("using System;");
     op.WriteLine(" ");
     op.WriteLine("namespace Server.Items");
     op.WriteLine("{");
     op.WriteLine(String.Format("    public class {0} : {1}", ClassName, it.GetType().Name));
     op.WriteLine("    {");
     op.WriteLine("        [Constructable]");
     op.WriteLine(String.Format("        public {0}() : base( {1} )", ClassName, it.ItemID.ToString()));
     op.WriteLine("        {");
     op.WriteLine(String.Format("            this.Name = \"{0}\";", it.Name));
     op.WriteLine(String.Format("            this.Hue = {0};", it.Hue.ToString()));
     op.WriteLine("        }");
     op.WriteLine(" ");
     op.WriteLine(String.Format("        public {0}( Serial serial ) : base( serial )", ClassName));
     op.WriteLine("        {");
     op.WriteLine("        }");
     op.WriteLine(" ");
     op.WriteLine("        public override void Serialize( GenericWriter writer )");
     op.WriteLine("        {");
     op.WriteLine("            base.Serialize( writer );");
     op.WriteLine(" ");
     op.WriteLine("            writer.Write( (int) 0 ); // version");
     op.WriteLine("        }");
     op.WriteLine(" ");
     op.WriteLine("        public override void Deserialize( GenericReader reader )");
     op.WriteLine("        {");
     op.WriteLine("            base.Deserialize( reader );");
     op.WriteLine(" ");
     op.WriteLine("            int version = reader.ReadInt();");
     op.WriteLine("        }");
     op.WriteLine("    }");
     op.WriteLine("}");
     op.Flush();
 }
开发者ID:FreeReign,项目名称:aosredux,代码行数:36,代码来源:GenScriptv1_2.cs


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