0

Serialization is a known concept, widely used in Java. But how to implement it in C#? Are there interfaces used?

It is possible to use a C# serialized implementation within VB.Net and vise versa? (somewhat an independent class)?

I would appreciate a simplified example that points to valuable references. (not asking for spoon feeding)

PS: Certainly the underlying need of this question would be "What is a C# serialized implementation and how to do it"?

bonCodigo
  • 14,268
  • 1
  • 48
  • 91
  • 2
    What results did your search for "C# serialize object" yield, what part did you not understand, what exactly are you asking? What is _"a C# serialized implementation"_? And yes, when using the same family of deserialization in VB.NET as used to serialize in C# and when the class definition is available, you can exchange serialized objects between programs in both languages. – CodeCaster May 10 '14 at 13:02
  • 2
    Its a [well](http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx) [known](http://msdn.microsoft.com/en-us/library/system.runtime.serialization.iserializable.aspx) [concept](http://msdn.microsoft.com/en-us/library/bb412179(v=vs.110).aspx) in .Net as well :) And yes, serialization into a neutral format will allow transport across different languages, machines, O/S's et al. – StuartLC May 10 '14 at 13:04
  • @CodeCaster Ofcourse I did search - reading them got me bit confused with XML involvement and jargon which was bit too hard to digest yet. Search results that I looked into: [1.](http://msdn.microsoft.com/en-us/library/ms233843.aspx) [2.](http://stackoverflow.com/questions/3042665/what-is-the-meaning-of-serialization-concept-in-programming-languages) [3.](http://www.codeproject.com/Articles/1789/Object-Serialization-using-C) – bonCodigo May 10 '14 at 14:00
  • @StuartLC thanks for being lenient and informative on my question. From the way question is formed, sure you may have noticed my "nooby"-ness on the context. – bonCodigo May 10 '14 at 14:02
  • 1
    If you can possibly be more specific about where you are getting stuck I'm sure the community will be much more helpful :) e.g. are you looking for a particular type of Serialization (e.g. Xml, JSON, or some proprietary binary format?) – StuartLC May 10 '14 at 14:09
  • @StuartLC When reading about XML and JSON it seems JSON is taking the race ahead. But it depends on individual's need. As of now I don't have a project need. But I am literally trying to *learn-to-code/be able to apply logically* few intermediate/advanced concepts in C# - one of those being Serialization. In terms of a learner's perspective, what do you suggest me as a good source/tutorial to get going? I want to get my hands dirty and then will hit SE (most likely). – bonCodigo May 10 '14 at 14:12
  • @CodeCaster seems like my question is *that bad* to get an answer like *that*... sigh++ – bonCodigo May 11 '14 at 01:16

1 Answers1

1

MSDN has a decent high-level tutorial on c# serialization here, but it sounds like you have a high-level understanding from your Java background.

LizH
  • 445
  • 6
  • 19
  • sorry = hit submit too soon, still typing – LizH May 10 '14 at 14:15
  • Anyway. As for how to use it. The baked-in "c# serialization", which uses the serializable attribute on an object (as opposed to JSON/XML) has a nice sample code [here](http://msdn.microsoft.com/en-us/library/system.serializableattribute.aspx). – LizH May 10 '14 at 14:20
  • Thanks for the tutorials. I have to dig a bit deeper in terms of file systems, database locks and thread-safety. All seems to be built in already... – bonCodigo May 27 '14 at 06:56