• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ObjectDumper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ObjectDumper的典型用法代码示例。如果您正苦于以下问题:C# ObjectDumper类的具体用法?C# ObjectDumper怎么用?C# ObjectDumper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ObjectDumper类属于命名空间,在下文中一共展示了ObjectDumper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Write

 public static void Write(object element, int depth, TextWriter log)
 {
     ObjectDumper dumper = new ObjectDumper(depth);
     dumper.writer = log;
     dumper.WriteObject(null, element);
     log.WriteLine(new string('-', 20));
 }
开发者ID:diamondiamon,项目名称:WeikerenUtility,代码行数:7,代码来源:ObjectDumper.cs


示例2: Write

 public static string Write(object o, int depth)
 {
     var sw = new StringWriter();
     sw.NewLine = "\r\n";
     ObjectDumper dumper = new ObjectDumper(sw, depth);
     dumper.WriteObject(null, o);
     return sw.ToString();
 }
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:8,代码来源:ObjectDumper.cs


示例3: Write

 public static void Write(object element, int depth, NLog.Logger log)
 {
     if (log.IsTraceEnabled)
     {
         ObjectDumper dumper = new ObjectDumper(depth);
         dumper.WriteObject(null, element);
         log.Trace(dumper.builder);
     }
 }
开发者ID:andyhoyle,项目名称:Crucial.Framework,代码行数:9,代码来源:ObjectDumper.cs


示例4: String

 /// <summary>
 /// Dumps the object to a string. Added for convenience by Pete.
 /// </summary>
 public static string String(object element)
 {
     using (var w = new StringWriter())
     {
         var dumper = new ObjectDumper(0) { writer = w };
         dumper.WriteObject(null, element);
         return w.ToString();
     }
 }
开发者ID:jncc,项目名称:topcat,代码行数:12,代码来源:ObjectDumper.cs


示例5: ToString

	public static string ToString(object o, int depth = 0)
	{
		using (var sw = new StringWriter())
		{
			ObjectDumper dumper = new ObjectDumper(depth, sw);
			dumper.WriteObject(null, o);
			return sw.ToString();
		}
	}
开发者ID:Nouser,项目名称:LolNotes,代码行数:9,代码来源:ObjectDumper.cs


示例6: DumpValueTypeInteger

        public void DumpValueTypeInteger() {
            var objectDumper = new ObjectDumper(1);
            var xElement = objectDumper.Dump(1337, "Model");

            var stringBuilder = new StringBuilder();
            ObjectDumper.ConvertToJSon(xElement, stringBuilder);
            var json = stringBuilder.ToString();

            var jObject = new JObject(
                new JProperty("name", "Model"), 
                new JProperty("value", "1337"));

            ComparareJsonObject(jObject, json);
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:14,代码来源:ObjectDumperTests.cs


示例7: Dump

		/// <summary>
		/// Dumps values of the specified target.
		/// </summary>
		/// <param name="target">The target.</param>
		/// <param name="depth">The depth of the dump.</param>
		/// <returns>A string representing the object dump.</returns>
		public static string Dump(object target, int depth)
		{
			try
			{
				using (var dumper = new ObjectDumper(depth))
				{
					dumper.WriteObject(null, target);
					return dumper.ToString().TrimEnd(Environment.NewLine.ToCharArray());
				}
			}
			catch (Exception ex)
			{
				return string.Format("Dump failure: {0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace);
			}
		}
开发者ID:zhangz,项目名称:Toolbox,代码行数:21,代码来源:ObjectDumper.cs


示例8: DumpObject_DepthOne

        public void DumpObject_DepthOne() {
            var objectDumper = new ObjectDumper(1);
            var xElement = objectDumper.Dump(new TestObject
            {
                SomeInteger = 1337,
                SomeBoolean = true,
                SomeString = "Never gonna give you up"
            }, "Model");

            Assert.Throws(typeof (NullReferenceException), () => {
                var stringBuilder = new StringBuilder();
                ObjectDumper.ConvertToJSon(xElement, stringBuilder);
                var json = stringBuilder.ToString();
            });
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:15,代码来源:ObjectDumperTests.cs


示例9: DumpContentItem_DepthSix

        public void DumpContentItem_DepthSix() {
            var contentItem = new ContentItem { ContentType = "TestContentType" };
            var testingPart = new ContentPart { TypePartDefinition = new ContentTypePartDefinition(new ContentPartDefinition("TestingPart"), new SettingsDictionary()) };
            contentItem.Weld(testingPart);

            var objectDumper = new ObjectDumper(6);
            var xElement = objectDumper.Dump(contentItem, "Model");

            var stringBuilder = new StringBuilder();
            ObjectDumper.ConvertToJSon(xElement, stringBuilder);
            var json = stringBuilder.ToString();

            var jObject = new JObject(
                new JProperty("name", "Model"),
                new JProperty("value", "ContentItem"),
                new JProperty("children", new JArray(
                    new JObject(
                        new JProperty("name", "Id"),
                        new JProperty("value", "0")),
                    new JObject(
                        new JProperty("name", "Version"),
                        new JProperty("value", "0")),
                    new JObject(
                        new JProperty("name", "ContentType"),
                        new JProperty("value", "&quot;TestContentType&quot;")),
                    new JObject(
                        new JProperty("name", "TestingPart"),
                        new JProperty("value", "ContentPart"),
                        new JProperty("children", new JArray(
                            new JObject(
                                new JProperty("name", "Id"),
                                new JProperty("value", "0")),
                            new JObject(
                                new JProperty("name", "TypeDefinition"),
                                new JProperty("value", "null")),
                            new JObject(
                                new JProperty("name", "TypePartDefinition"),
                                new JProperty("value", "ContentTypePartDefinition"),
                                new JProperty("children", new JArray(
                                    new JObject(
                                        new JProperty("name", "PartDefinition"),
                                        new JProperty("value", "ContentPartDefinition"),
                                        new JProperty("children", new JArray(
                                                new JObject(
                                                    new JProperty("name", "Name"),
                                                    new JProperty("value", "&quot;TestingPart&quot;")),
                                                new JObject(
                                                    new JProperty("name", "Fields"),
                                                    new JProperty("value", "ContentPartFieldDefinition[]")),
                                                new JObject(
                                                    new JProperty("name", "Settings"),
                                                    new JProperty("value", "SettingsDictionary"))))),
                                    new JObject(
                                        new JProperty("name", "Settings"),
                                        new JProperty("value", "SettingsDictionary")),
                                    new JObject(
                                        new JProperty("name", "ContentTypeDefinition"),
                                        new JProperty("value", "null"))))),
                            new JObject(
                                new JProperty("name", "PartDefinition"),
                                new JProperty("value", "ContentPartDefinition"),
                                new JProperty("children", new JArray(
                                    new JObject(
                                        new JProperty("name", "Name"),
                                        new JProperty("value", "&quot;TestingPart&quot;")),
                                    new JObject(
                                        new JProperty("name", "Fields"),
                                        new JProperty("value", "ContentPartFieldDefinition[]")),
                                    new JObject(
                                        new JProperty("name", "Settings"),
                                        new JProperty("value", "SettingsDictionary"))))),
                            new JObject(
                                new JProperty("name", "Settings"),
                                new JProperty("value", "SettingsDictionary")),
                            new JObject(
                                new JProperty("name", "Fields"),
                                new JProperty("value", "List&lt;ContentField&gt;"))))))));

            ComparareJsonObject(jObject, json);
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:80,代码来源:ObjectDumperTests.cs


示例10: A

 public void A()
 {
     var dic = new Dictionary<string, string> { { "Key 1", "Value 1" }, { "Key 2", "Value 2" } };
     var x = new ObjectDumper().Dump(typeof(Object));
 }
开发者ID:ByteCarrot,项目名称:Aspy,代码行数:5,代码来源:ObjectDumperTests.cs


示例11: FullDump

 public void FullDump()
 {
     ObjectDumper dumper = new ObjectDumper(4, true, true, (System.Reflection.BindingFlags.FlattenHierarchy));
     logger.Error("Dump of the spellbook of {0} : ", Character.Name);
     foreach (var spell in m_spells)
     {
         logger.Error("   Spell {0}", spell.ToString(true));
         foreach (var effectdice in spell.LevelTemplate.effects)
         {
             EffectBase effect = new EffectBase(effectdice);
             logger.Error("       Effect {0} : {1} - {2} {3:P}", effect.Description, effectdice.diceNum <= effectdice.diceSide ? effectdice.diceNum : effectdice.diceSide, effectdice.diceNum > effectdice.diceSide ? effectdice.diceNum : effectdice.diceSide, effectdice.random == 0 ? 1.0 : effectdice.random / 100.0);
         }
     }
 }
开发者ID:Ryuuke,项目名称:BehaviorIsManaged,代码行数:14,代码来源:SpellsBook.cs


示例12: DumpShape_DepthOne

        public void DumpShape_DepthOne() {
            var objectDumper = new ObjectDumper(1);
            var testShape = new TestShape
            {
                Metadata = new ShapeMetadata()
                {
                    Type = "TestContentType",
                    DisplayType = "Detail",
                    Alternates = new[] { "TestContentType_Detail", "TestContentType_Detail_2" },
                    Position = "1",
                    ChildContent = new HtmlString("<p>Test Para</p>"),
                    Wrappers = new[] { "TestContentType_Wrapper" }
                },
                SomeInteger = 1337,
                SomeBoolean = true,
                SomeString = "Never gonna give you up"
            };

            testShape.Classes.Add("bodyClass1");
            testShape.Classes.Add("bodyClass2");

            testShape.Add("Child Item");

            testShape.Attributes.Add(new KeyValuePair<string, string>("onClick", "dhtmlIsBad"));

            var xElement = objectDumper.Dump(testShape, "Model");

            Assert.Throws(typeof(NullReferenceException), () =>
            {
                var stringBuilder = new StringBuilder();
                ObjectDumper.ConvertToJSon(xElement, stringBuilder);
                var json = stringBuilder.ToString();
            });
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:34,代码来源:ObjectDumperTests.cs


示例13: Write

 public static void Write(object o, int depth, TextWriter log)
 {
     var dumper = new ObjectDumper(depth) {_writer = log};
     dumper.WriteObject(null, o);
 }
开发者ID:samplet,项目名称:HalfAndHalf,代码行数:5,代码来源:ObjectDumper.cs


示例14: Write

 public static void Write(object o, int depth)
 {
     ObjectDumper dumper = new ObjectDumper(depth);
     dumper.WriteObject(null, o);
 }
开发者ID:CeeJay79,项目名称:aion_ext,代码行数:5,代码来源:ObjectDumper.cs


示例15: Write

	public static void Write(object o, int depth = 0)
	{
		ObjectDumper dumper = new ObjectDumper(depth, Console.Out);
		dumper.WriteObject(null, o);
	}
开发者ID:Nouser,项目名称:LolNotes,代码行数:5,代码来源:ObjectDumper.cs


示例16: Write

 internal static void Write(object o, int depth, TextWriter log)
 {
     ObjectDumper dumper = new ObjectDumper(depth);
     dumper.writer = log;
     dumper.WriteObject(null, o);
 }
开发者ID:jaykizhou,项目名称:elinq,代码行数:6,代码来源:ObjectDumper.cs


示例17: WriteTo

	public static void WriteTo(object o, Stream stream, int depth = 0)
	{
		ObjectDumper dumper = new ObjectDumper(depth, new StreamWriter(stream));
		dumper.WriteObject(null, o);
	}
开发者ID:Nouser,项目名称:LolNotes,代码行数:5,代码来源:ObjectDumper.cs


示例18: DumpShapeAndChild_DepthSix

        public void DumpShapeAndChild_DepthSix() {
            var objectDumper = new ObjectDumper(6);
            var testShape = new TestShape
            {
                Metadata = new ShapeMetadata
                {
                    Type = "TestContentType",
                    DisplayType = "Detail",
                    Alternates = new[] { "TestContentType_Detail", "TestContentType_Detail_2" },
                    Position = "1",
                    ChildContent = new HtmlString("<p>Test Para</p>"),
                    Wrappers = new[] { "TestContentType_Wrapper" }
                },
                SomeInteger = 1337,
                SomeBoolean = true,
                SomeString = "Never gonna give you up"
            };

            testShape.Classes.Add("bodyClass1");
            testShape.Classes.Add("bodyClass2");

            testShape.Add(new TestShape
            {
                Metadata = new ShapeMetadata
                {
                    Type = "TestContentChildType",
                    DisplayType = "Detail",
                    Alternates = new[] { "TestContentChildType_Detail", "TestContentChildType_Detail_2" },
                    Position = "1",
                    ChildContent = new HtmlString("<p>Test Child Para</p>"),
                    Wrappers = new[] { "TestContentChildType_Wrapper" }
                },
                SomeInteger = 1337,
                SomeBoolean = true,
                SomeString = "Never gonna give you up"
            });

            testShape.Attributes.Add(new KeyValuePair<string, string>("onClick", "dhtmlIsBad"));

            var xElement = objectDumper.Dump(testShape, "Model");

            var stringBuilder = new StringBuilder();
            ObjectDumper.ConvertToJSon(xElement, stringBuilder);
            var json = stringBuilder.ToString();

            var jObject = new JObject(
                new JProperty("name", "Model"),
                new JProperty("value", "TestContentType Shape"),
                new JProperty("children", new JArray(
                    new JObject(
                        new JProperty("name", "Classes"),
                        new JProperty("value", "List&lt;String&gt;"),
                        new JProperty("children", new JArray(
                            new JObject(
                                new JProperty("name", "[0]"),
                                new JProperty("value", "&quot;bodyClass1&quot;")),
                            new JObject(
                                new JProperty("name", "[1]"),
                                new JProperty("value", "&quot;bodyClass2&quot;"))))),
                    new JObject(
                        new JProperty("name", "Attributes"),
                        new JProperty("value", "Dictionary&lt;String, String&gt;"),
                        new JProperty("children", new JArray(
                            new JObject(
                                new JProperty("name", "[&quot;onClick&quot;]"),
                                new JProperty("value", "&quot;dhtmlIsBad&quot;"))))),
                    new JObject(
                        new JProperty("name", "Items"),
                        new JProperty("value", "List&lt;Object&gt;"),
                        new JProperty("children", new JArray(
                            new JObject(
                                new JProperty("name", "[0]"),
                                new JProperty("value", "TestContentChildType Shape"),
                                new JProperty("children", new JArray(
                                    new JObject(
                                        new JProperty("name", "Classes"),
                                        new JProperty("value", "List&lt;String&gt;")),
                                    new JObject(
                                        new JProperty("name", "Attributes"),
                                        new JProperty("value", "Dictionary&lt;String, String&gt;")),
                                    new JObject(
                                        new JProperty("name", "Items"),
                                        new JProperty("value", "List&lt;Object&gt;")))))))))));

            ComparareJsonObject(jObject, json);
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:86,代码来源:ObjectDumperTests.cs


示例19: DumpIShape_DepthOne

        public void DumpIShape_DepthOne() {
            var objectDumper = new ObjectDumper(1);
            var xElement = objectDumper.Dump(new TestIShape {
                Metadata = new ShapeMetadata() {
                    Type = "TestContentType",
                    DisplayType = "Detail",
                    Alternates = new[] { "TestContentType_Detail", "TestContentType_Detail_2" },
                    Position = "1",
                    ChildContent = new HtmlString("<p>Test Para</p>"),
                    Wrappers = new[] { "TestContentType_Wrapper" }
                },
                SomeInteger = 1337,
                SomeBoolean = true,
                SomeString = "Never gonna give you up"
            }, "Model");

            Assert.Throws(typeof(NullReferenceException), () => {
                var stringBuilder = new StringBuilder();
                ObjectDumper.ConvertToJSon(xElement, stringBuilder);
                var json = stringBuilder.ToString();
            });
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:22,代码来源:ObjectDumperTests.cs


示例20: DumpShape_DepthTwo

        public void DumpShape_DepthTwo() {
            var objectDumper = new ObjectDumper(2);
            var testShape = new TestShape
            {
                Metadata = new ShapeMetadata()
                {
                    Type = "TestContentType",
                    DisplayType = "Detail",
                    Alternates = new[] { "TestContentType_Detail", "TestContentType_Detail_2" },
                    Position = "1",
                    ChildContent = new HtmlString("<p>Test Para</p>"),
                    Wrappers = new[] { "TestContentType_Wrapper" }
                },
                SomeInteger = 1337,
                SomeBoolean = true,
                SomeString = "Never gonna give you up"
            };

            testShape.Classes.Add("bodyClass1");
            testShape.Classes.Add("bodyClass2");

            testShape.Add("Child Item");

            testShape.Attributes.Add(new KeyValuePair<string, string>("onClick", "dhtmlIsBad"));

            var xElement = objectDumper.Dump(testShape, "Model");

            var stringBuilder = new StringBuilder();
            ObjectDumper.ConvertToJSon(xElement, stringBuilder);
            var json = stringBuilder.ToString();

            var jObject = new JObject(
                new JProperty("name", "Model"),
                new JProperty("value", "TestContentType Shape"));

            ComparareJsonObject(jObject, json);
        }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:37,代码来源:ObjectDumperTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ObjectEntry类代码示例发布时间:2022-05-24
下一篇:
C# ObjectDisplayOptions类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap