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


C# Foo.GetType方法代码示例

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


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

示例1: ReturnsWhatTheSerializeToByteArrayExtensionMethodOnTheDefaultBinarySerializerReturns

        public void ReturnsWhatTheSerializeToByteArrayExtensionMethodOnTheDefaultBinarySerializerReturns()
        {
            var foo = new Foo { Bar = "abc123" };

            var result = foo.ToBinary();

            var expectedResult = DefaultBinarySerializer.Current.SerializeToByteArray(foo, foo.GetType());

            Assert.That(result, Is.EqualTo(expectedResult));
        }
开发者ID:RockFramework,项目名称:Rock.Core,代码行数:10,代码来源:ToBinaryExtensionTests.cs

示例2: ExpressionPropertyInvoker_GetPropertyValue_Test

		public void ExpressionPropertyInvoker_GetPropertyValue_Test()
		{
			var foo = new Foo();
			var propertyInfo = foo.GetType().GetProperty("Bar");

			foo.Bar = "Hello";
			var result = ExpressionPropertyInvoker.Instance
				.GetPropertyValue(propertyInfo, foo);

			Assert.That(result, Is.EqualTo(foo.Bar));
		}
开发者ID:nuxleus,项目名称:ServiceStack.OrmLite,代码行数:11,代码来源:TestScripts.cs

示例3: ExpressionPropertyInvoker_SetPropertyValue_Test

		public void ExpressionPropertyInvoker_SetPropertyValue_Test()
		{
			var foo = new Foo();
			var propertyInfo = foo.GetType().GetProperty("Bar");

			ExpressionPropertyInvoker.Instance.ConvertValueFn
				= new SqliteOrmLiteDialectProvider().ConvertDbValue;

			ExpressionPropertyInvoker.Instance
				.SetPropertyValue(propertyInfo, typeof(string), foo, "Hello");

			Assert.That(foo.Bar, Is.EqualTo(foo.Bar));
		}
开发者ID:nuxleus,项目名称:ServiceStack.OrmLite,代码行数:13,代码来源:TestScripts.cs

示例4: Test_structs_with_double_quotes

        public void Test_structs_with_double_quotes()
        {
            var dto = new Foo { Content1 = "My \"quoted\" content", Name = "My \"quoted\" name" };

            JsConfig<Text>.SerializeFn = text => text.ToString();
            JsConfig<Text>.DeSerializeFn = v => new Text(v);

            var json = JsonSerializer.SerializeToString(dto, dto.GetType());
            Assert.That(json, Is.EqualTo("{\"Name\":\"My \\\"quoted\\\" name\",\"Content1\":\"My \\\"quoted\\\" content\"}"));

            var foo = JsonSerializer.DeserializeFromString<Foo>(json);
            Assert.That(foo.Name, Is.EqualTo(dto.Name));
            Assert.That(foo.Content1, Is.EqualTo(dto.Content1));
        }
开发者ID:sami1971,项目名称:NServiceKit.Text,代码行数:14,代码来源:StructTests.cs

示例5: Test_structs

        public void Test_structs()
        {
            JsConfig<Text>.SerializeFn = text => text.ToString();

            var dto = new Foo { Content1 = "My content", Name = "My name" };

            var json = JsonSerializer.SerializeToString(dto, dto.GetType());

            Assert.That(json, Is.EqualTo("{\"Name\":\"My name\",\"Content1\":\"My content\"}"));
        }
开发者ID:sami1971,项目名称:NServiceKit.Text,代码行数:10,代码来源:StructTests.cs

示例6: CompareFoo

 private static void CompareFoo(Foo original, Foo clone, string message)
 {
     Assert.IsNotNull(clone, message);
     Assert.AreNotSame(original, clone);
     Assert.AreEqual(original.Id, clone.Id, message + ": Id");
     Assert.AreEqual(original.Name, clone.Name, message + ": Name");
     Assert.AreEqual(typeof(Foo), clone.GetType(), message);
 }
开发者ID:Erguotou,项目名称:protobuf-net,代码行数:8,代码来源:NHibernateProxies.cs


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