title: How to Serialize an Object from C# to a mySql database
body: <p>Im fairly new to C# i want to create a database where i can store a serialized object and then retrieve them and cast to the relavant object type</p>
  
  <p>My database is mysql and has a type BLOB to store the serialized data </p>
  
  <p>I do not want tu use XML serialization
  i want to serialize this using pure C# like in java</p>
  
  <p>if someone can give me a link or some help doing this it would be great...!!!</p>
  
  <p>This is the class i want to serialize </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Runtime.Serialization;
  using System.Runtime.Serialization.Formatters.Binary;
  
  namespace Login 
  {
      [Serializable()]
      class Worker : ISerializable
      {
  
          String fName;
  
          public String FName
          {
              get { return fName; }
              set { fName = value; }
          }
  
          String lName;
  
          public String LName
          {
              get { return lName; }
              set { lName = value; }
          }
  
          String TP;
  
          public String TP1
          {
              get { return TP; }
              set { TP = value; }
          }
  
          String department;
  
          public String Department
          {
              get { return department; }
              set { department = value; }
          }
  
          public Worker(String fname,String lname , String tp , String Departhment )
          {
              this.fName = fname;
              this.lName = lname;
              this.TP = tp;
              this.Department = department;
          }
  
  
          public void getObjectData(SerializationInfo info , StreamingContext context)
          {
              info.AddValue("fName",fName);
              info.AddValue("lName", lName);
              info.AddValue("TP",TP);
              info.AddValue("Department", Department);
          }
      }
  }
  </code></pre>