serialization

DataContractSerializer not Serializing member of class that inherits ISerializable

半腔热情 提交于 2020-01-03 15:22:09
问题 I have this class: using System; using System.Collections.Generic; using System.Runtime.Serialization; namespace Grouping { [Serializable] public class Group<T> : HashSet<T> { public Group(string name) { this.name = name; } protected Group(){} protected Group(SerializationInfo info, StreamingContext context):base(info,context) { name = info.GetString("koosnaampje"); } public override void GetObjectData(SerializationInfo info,StreamingContext context) { base.GetObjectData(info,context); info

Why is setting the classloader necessary with Scala RemoteActors?

北城以北 提交于 2020-01-03 14:14:22
问题 When using Scala RemoteActors I was getting a ClassNotFoundException that referred to scala.actors.remote.NetKernel. I copied someone else's example and added RemoteActor.classLoader = getClass.getClassLoader to my Actor and now everything works. Why is this necessary? 回答1: Remote Actors use Java serialization to send messages back and forth. Inside the actors library, you'll find a custom object input stream ( https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/actors/scala/actors

Why is setting the classloader necessary with Scala RemoteActors?

天大地大妈咪最大 提交于 2020-01-03 14:14:13
问题 When using Scala RemoteActors I was getting a ClassNotFoundException that referred to scala.actors.remote.NetKernel. I copied someone else's example and added RemoteActor.classLoader = getClass.getClassLoader to my Actor and now everything works. Why is this necessary? 回答1: Remote Actors use Java serialization to send messages back and forth. Inside the actors library, you'll find a custom object input stream ( https://lampsvn.epfl.ch/trac/scala/browser/scala/trunk/src/actors/scala/actors

type to int mapping

做~自己de王妃 提交于 2020-01-03 13:41:07
问题 I have two c++ programs that need to have a map type -> int that is known at compile time and equal between the two programs. Furthermore, I'd like to automatically make sure at compile time that the map is one-to-one. How would you solve that? (c++0x-extensions are allowed). The first part is easy: Share a template < typename T > struct map; template <> struct map <...> { enum { val = ...; }; }; between the programs. (The second part means that I don't want to accidently define the same val

.NET Portable Class Library [Serializable] Attribute

送分小仙女□ 提交于 2020-01-03 10:47:30
问题 I have a common class library containing many models for my server and my client. Since the client is running under Xamarin, the common library must be a Portable Class Library (PCL). In my server, these objects are passed around with AppDomain Remoting/Marshaling, so to my understanding an object either needs to be marked as [Serializable] or inherit from MarshalByRefObject Being in a PCL, I cannot do either of these things to any of my models. My question is: How can I make these objects

Passing JSON serialized data via hidden field

Deadly 提交于 2020-01-03 09:57:27
问题 In ASP.NET WebForms I want to pass arbitrary data from server to client and back again. I am serializing to JSON and have been simply producing JavaScript that creates the object on the client. I have no problem sending data to the server with ajax, but there are situations where I also want to send a Javascript object data back to the server on postbacks. So I guess it needs to be in a hidden field. A couple general questions about this. 1) What is the best way to do this in terms of

how to serialize a DataTable to json or xml

一笑奈何 提交于 2020-01-03 08:45:13
问题 i'm trying to serialize DataTable to Json or XML. is it possibly and how? any tutorials and ideas, please. For example a have a sql table: CREATE TABLE [dbo].[dictTable]( [keyValue] [int] IDENTITY(1,1) NOT NULL, [valueValue] [int] NULL, CONSTRAINT [Psd2Id] PRIMARY KEY CLUSTERED ( [keyValue] ASC )WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] C# code: string connectionString = "server=localhost;database=dbd;uid=**;pwd=**"; SqlConnection mySqlConnection = new

WCF List<string > serialization/deserialization error

柔情痞子 提交于 2020-01-03 08:42:40
问题 I have the following ServiceContract and DataContract classes: [ServiceContract] public interface IWcfService { [OperationContract] Response GetData(); } [DataContract] public class Response { [DataMember] public Dictionary<string, object> Data { get; set; } } When the value of Response.Data dictionary is of type int, string, double or any other 'simple' primitive types, WCF can successfully serialize the object. But when the value of Response.Data dictionary is of type List< string>, the

Proguard keep classmembers

泄露秘密 提交于 2020-01-03 07:34:06
问题 How can I tell proguard to keep my classmembers? I need them for JSON compatibility... This is my class: package com.tools.app.holiday; public class Holiday { private String name; private Calendar dateFrom = Calendar.getInstance(); private Calendar dateTo = Calendar.getInstance(); ... I already tried, but it doesnt work... -keepclassmembers class com.tools.app.holiday.Holiday -keepclassmembers class com.tools.app.holiday.Holiday *{ private String name; private Calendar dateFrom; private

How to get JSON serialized string using Dart Serialization

泄露秘密 提交于 2020-01-03 07:24:08
问题 For the following code var address = new Address(); address.street = 'N 34th'; address.city = 'Seattle'; var serialization = new Serialization() ..addRuleFor(address); String output = serialization.write(address); How do i get a json output like this: address: {'street':'N 34th', 'city':'Seattle'} Output generated by above code is as follows: {"roots":[{"__Ref":true,"rule":3,"object":0}],"data":[[],[],[],[["Seattle","N 34th"]]],"rules":"{\"roots\":[{\"__Ref\":true,\"rule\":1,\"object\":0}],\