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


C# Collection.JsonSerialize方法代码示例

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


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

示例1: op_JsonSerialize_object_whenCollectionOfString

        public void op_JsonSerialize_object_whenCollectionOfString(string expected)
        {
            var obj = new Collection<string>
                          {
                              "abc",
                              "xyz"
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例2: op_JsonSerialize_object_whenCollectionOfObjectType

        public void op_JsonSerialize_object_whenCollectionOfObjectType(string expected)
        {
            var obj = new Collection<object>
                          {
                              new object(),
                              new object()
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例3: op_JsonSerialize_object_whenCollectionOfSingle

        public void op_JsonSerialize_object_whenCollectionOfSingle(string expected)
        {
            var obj = new Collection<float>
                          {
                              1.23f,
                              4.56f
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例4: op_JsonSerialize_object_whenCollectionOfInt16

        public void op_JsonSerialize_object_whenCollectionOfInt16(string expected)
        {
            var obj = new Collection<short>
                          {
                              123,
                              456
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例5: op_JsonSerialize_object_whenCollectionOfNull

        public void op_JsonSerialize_object_whenCollectionOfNull(string expected)
        {
            var obj = new Collection<object>
                          {
                              null,
                              null
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例6: op_JsonSerialize_object_whenCollectionOfObject

        public void op_JsonSerialize_object_whenCollectionOfObject(string expected)
        {
            var obj = new Collection<XmlNamespace>
                          {
                              new XmlNamespace("com", "http://example.com"),
                              new XmlNamespace("net", "http://example.net")
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例7: op_JsonSerialize_object_whenCollectionOfByte

        public void op_JsonSerialize_object_whenCollectionOfByte(string expected)
        {
            var obj = new Collection<byte>
                          {
                              1,
                              255
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例8: op_JsonSerialize_object_whenCollectionOfInt64

        public void op_JsonSerialize_object_whenCollectionOfInt64(string expected)
        {
            var obj = new Collection<long>
                          {
                              12345,
                              67890
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例9: op_JsonSerialize_object_whenCollectionOfGuid

        public void op_JsonSerialize_object_whenCollectionOfGuid(string expected)
        {
            var obj = new Collection<Guid>
                          {
                              XmlConvert.ToGuid("b75a9ea5-01ca-4a61-b299-8d0823a4a64a"),
                              XmlConvert.ToGuid("ce6a8e72-b5dc-4682-b9ce-23351d9d2f4a")
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例10: op_JsonSerialize_object_whenCollectionOfDouble

        public void op_JsonSerialize_object_whenCollectionOfDouble(string expected)
        {
            var obj = new Collection<double>
                          {
                              1.23d,
                              4.56d
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例11: op_JsonSerialize_object_whenCollectionOfEnum

        public void op_JsonSerialize_object_whenCollectionOfEnum(string expected)
        {
            var obj = new Collection<DayOfWeek>
                          {
                              DayOfWeek.Monday,
                              DayOfWeek.Friday
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例12: op_JsonSerialize_object_whenCollectionOfDecimal

        public void op_JsonSerialize_object_whenCollectionOfDecimal(string expected)
        {
            var obj = new Collection<decimal>
                          {
                              1.23m,
                              4.56m
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例13: op_JsonSerialize_object_whenCollectionOfDateTimeOffset

        public void op_JsonSerialize_object_whenCollectionOfDateTimeOffset(string expected)
        {
            var obj = new Collection<DateTimeOffset>
                          {
                              new DateTime(1999, 12, 31),
                              new DateTime(2000, 1, 1)
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例14: op_JsonSerialize_object_whenCollectionOfChar

        public void op_JsonSerialize_object_whenCollectionOfChar(string expected)
        {
            var obj = new Collection<char>
                          {
                              'a',
                              'z'
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs

示例15: op_JsonSerialize_object_whenCollectionOfTimeSpan

        public void op_JsonSerialize_object_whenCollectionOfTimeSpan(string expected)
        {
            var obj = new Collection<TimeSpan>
                          {
                              new TimeSpan(1, 2, 3),
                              new TimeSpan(4, 5, 6)
                          };
            var actual = obj.JsonSerialize();

            Assert.Equal(expected, actual);
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:11,代码来源:Json.Object.ExtensionMethods.Facts.cs


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