serialization

Compare two structs' values in C#

故事扮演 提交于 2019-12-22 07:49:14
问题 I'm not looking for a comparison of two structs that returns bool, I am wondering if there is a way to get which fields of two structs (the same structure, but maybe different values) are different. Basically I want a simpler way to do the following: public class Diff { public String VarName; public object Val1; public object Val2; public Diff(String varName, object val1, object val2) { VarName = varName; Val1 = val1; Val2 = val2; } public override string ToString() { return VarName + "

JSON serializing of complex object MVC3

淺唱寂寞╮ 提交于 2019-12-22 07:19:41
问题 I have a problem, I don't seem to know how to serialize a object of type: public class SchedulingCalendarMonth { public List<SchedulingCalendarWeek> Weeks {get; set; } } public class SchedulingCalendarWeek { public List<SchedulingCalendarDay> Days { get; set; } } public class SchedulingCalendarDay { public int Id { get; set; } public bool SomeBoolProperty { get; set; } } I've tried something like this: <script type="text/javascript"> $(document).ready(function () { var Month = { Weeks: [] };

JSON serializing of complex object MVC3

爱⌒轻易说出口 提交于 2019-12-22 07:19:28
问题 I have a problem, I don't seem to know how to serialize a object of type: public class SchedulingCalendarMonth { public List<SchedulingCalendarWeek> Weeks {get; set; } } public class SchedulingCalendarWeek { public List<SchedulingCalendarDay> Days { get; set; } } public class SchedulingCalendarDay { public int Id { get; set; } public bool SomeBoolProperty { get; set; } } I've tried something like this: <script type="text/javascript"> $(document).ready(function () { var Month = { Weeks: [] };

c++ network serialization [closed]

两盒软妹~` 提交于 2019-12-22 07:05:53
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I'm looking for a solution for serializing of c++ packets to a network stream. I have seen many posts here refering people to: ACE Google Protocol Buffers Boost::Serialization Qt ::QDataStream My Requirements/ Constraints: The solution must be unaware of LitteEndian/BigEndian. Machine Architecture x86/x64 and

How to completely serialize/deserialize RSAParameters object

瘦欲@ 提交于 2019-12-22 06:50:20
问题 The RSAParameters object does not support serialization of private key data. How can I serialize and deserialize a private key completely? 回答1: The following code may be used to serialize and deserialize RSAParameters objects, using the serializer of your own choosing. using System; using System.Runtime.Serialization; using System.Security.Cryptography; [Serializable] public class RSAParametersSerializable : ISerializable { private RSAParameters _rsaParameters; public RSAParameters

Using @JsonIdentityInfo without annotations

北战南征 提交于 2019-12-22 06:38:20
问题 I use Jackson 2.2.3 to serialize POJOs to JSON. Then I had the problem, that I couldn't serialize recursive structures...I solved this problem by using @JsonIdentityInfo => works great. But, I don't want this annotation on the top of my POJO. So my question is: Is there any other possibility to set the default behavior of my ObjectMapper to use the feature for every POJO? So I want to transform this annotation code @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class,

Boost c++ serializing a char *

℡╲_俬逩灬. 提交于 2019-12-22 06:37:27
问题 I have a class and I am trying to serialize a shared_ptr but the normal method of serializing an object is not working: class Object { public: Object(); ~Object(); shared_ptr<char>objectone; friend class boost::serialization::access; template <typename Archive> void serialize(Archive &ar, const unsigned int version) { ar & objectone; } }; I've even attempted it in this way but it still doesn't work: void serialize(Archive &ar, const unsigned int version) { for (int i = 0; i < (strlen

Why Isn't My .Net Object Serializable?

偶尔善良 提交于 2019-12-22 05:36:09
问题 I've got a 'MyDataTable' class that inherits from System.Data.DataTable I've implemented ISerializable in my class and have a 'Public Overrides Sub GetObjectData...' But when I try to serialize the an object of 'MyDataTable' I get an error saying that 'MyDataTable' is not marked as serializable. If I used a DataTable instead - my code serializes correctly. If I add a serializable attribute to the 'MyDataTable' class - it serializes correctly, but I'm told that is unnecessary if I implement

How to deserialize Perl Data::Dumper output in PHP

偶尔善良 提交于 2019-12-22 05:33:31
问题 I have a result of export variable in Perl like this string: $VAR1 = { 'guard' => undef, 'work_hand' => undef, 'images' => {'1' => { 'mini_height' => 150, 'width' => 150, 'extension' => 'jpg', 'filename' => 'object_1.1330907414.96873.jpg', 'mini_width' => 150, 'class' => 'Ontico::Image', 'height' => 150, 'mini_filename' => 'object_1.1330907414.96873.mini.jpg', 'size' => 26053, 'symname' => 'big_logo' }, '2' => { 'width' => 48, 'extension' => 'jpg', 'alt' => 'Даниэле Галлоппа', 'height' => 48,

Storing generic List<CustomObject> using ApplicationSettingsBase

放肆的年华 提交于 2019-12-22 05:23:50
问题 I am trying to save a List<Foo> using ApplicationSettingsBase, however it only outputs the following even though the list is populated: <setting name="Foobar" serializeAs="Xml"> <value /> </setting> Foo is defined as follows: [Serializable()] public class Foo { public String Name; public Keys Key1; public Keys Key2; public String MashupString { get { return Key1 + " " + Key2; } } public override string ToString() { return Name; } } How can I enable ApplicationSettingsBase to store List<Foo>?