?? ????? C# ???? ?? ??? ?????. ?? ????? ??? ????? ???? ??? ???(serialization)?? ?? ?? ????? ??? ?? ??? ????? ???? ??? ????? ?? ??? ? ?? ??? ??? ????? ?????. ?? ??? ??? ???? ??? ????? ???? ???? ?? ?? ????? ?? ????, ??? ??? ???? ?? ?? ??? ?? ??? ?? ??? ???? ??? ???? ????? ?? ???? ???? ?????. ??? ???????.
C# ??? ??? ??
??? C# ??? ??? ?????.
- ??? ??? ?????.
- BinaryFormatter ??? ?????.
- Serialize( ) ???? ?????.
C# ??? ??
- ???????? ??? ??? ??? ???? ??? ??? ? ??? ?????? ????? ??? ???? ???? ???. ?? ??? ??? ???? ??? ? ????.
- ??? ????? ??? ????? ???? ??? ??? ??? ???? ??????? ??? ??? ????? ???.
- ???? ???? ????? ?? ??? ??? ????? ????? ???? ??????.
- ???? ???? ??? ???? ??? ?? ????.
- C#?? ???? ????? ????? Runtime.Serialization ??????? ???? ??? ???.
- [ ??? ?? ] ??? C#?? ???? ??? ???? ??? ? ?????.
[ ??? ?? ] ???? ???? ?? ???:
??:
[Serializable] public class Check { public int code; public string name; }
- ????? ???? ??? ???? ? ?? ??? ??? [ NonSerialized() ] ??? ??? ? ????.
[ NonSerialized() ] ??? ???? ?? ?? ?? ???? ?????.
??:
[Serializable] public class Check { public int code; public string name; [NonSerialized()] Public double price; }
- C#??? ??? ?? ??? ??? ?????.
??? C#?? ???? ??? ?????.
1. ???? ???
- ?? ??? ?? ? ?? ?? ?? ???? ??????.
- ???? ???? ???? ??? ???? ????? ???? ? ????.
- ??? ???? ???? ???? ?? ????? ????? ?? ??? ID? ?????.
- ???. ?? ??. Serilaization. ???. ???? ???? ????? ????? ???? ??????? ???? ??? ???.
2. SOAP ???
- Simple Object Access Protocol? SOAP? ?????.
- ? ???????? ??? ????? ??? ?? ???????? ??? ???? ?? ?? Simple Object Access Protocol Serialization? ?????.
- ???? Simple Object Access Protocol Serialization ??? ?? ?????.
- Simple Object Access Protocol Serialization? ???? Simple Object Access Protocol ???? ??? ???? ? ????.
- ???. ?? ??. Serilaization. ???. Simple Object Access Protocol ???? ????? ????? Soap ??????? ????? ???.
3. XML ???
- XML ???? ???? ??? ????? ?? ??? XML ????? ???? ? ????.
- XML ??? ??? ???? ??? ??? ?? ?? ????.
- XML ???? ???? ??? ??? ??? ?????.
- XML ???? ??? ?????.
- XML ???? ?? ?? ? ????.
- XML ???? ?? ??? ? ????.
- XmlAttribute? ??? ???? XML ???? ???? ??? ???? ? ????.
XmlAttribute ??? ???? ?? ?? ??? ?????.
??:
[XmlAttribute("Name")] public string Name { get { return Name; } set { Name = val; } }
- XmlSerializer? ???? XML ???? ???? ??? ??????.
XmlSerializer ??? ???? ?? ?? ??? ??????.
??:
XmlSerializer Serializer = new XmlSerializer(typeof(Prod)); using (TextWriter Writer = new StreamWriter(@"C:\Prod.xml")) { xmlSerializer.Serialize(Writer, prodObject); }
4. ??? ?? ???
- ?? ???? ??? ??? ? ????? ???? ?? ??? ?? ???? ?????.
- ISerialized ?????? ???? ??? ?? ???? ??? ? ????.
- GetObjectData() ???? ISerialized ?????? ?? ?????.
ISerialized ?????? ???? ??? ?? ???? ????? ?? ??? ?????.
??:
[Serializable] public class Prod : ISerializable { public void GetObjectData(SerializationInfo information, StreamingContext cont) { //Usual code } }
?
??? C# ???? ????.
??? ??? ???? C# ????
??:
using System; using System.IO; using System.Linq; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Text; using System.Threading.Tasks; //a namespace called demo is created namespace Demo { //Serializable attribute is declared [Serializable] //a class check is defined which will be used for serialization class Check { public int identity; public String nam; static void Main(string[] args) { //an object of the check class is created to serialize it to the file Example.txt Check ob = new Check(); ob.identity = 10; ob.nam = "Shobha"; //a file stream is created IFormatter format = new BinaryFormatter(); Stream stream1 = new FileStream(@"E:\Example.txt",FileMode.Create,FileAccess.Write); //serialization of the object of the class check is done format.Serialize(stream1, ob); stream1.Close(); //a file stream is created stream1 = new FileStream(@"E:\Example.txt",FileMode.Open,FileAccess.Read); //the object of the class check is deserialized Check ob1 = (Check)format.Deserialize(stream1); //the data is written to the console Console.WriteLine(ob1.identity); Console.WriteLine(ob1.nam); Console.ReadKey(); } } }
Output:
In the above program, a namespace called demo is defined. Then a Serializable attribute is defined. A class check is defined to demonstrate the concept of serialization using this class. Two properties identity and nam are defined in the class to which the values 10 and Shobha are assigned respectively. Then an object of the check class is created to serialize it to the file Example.txt. Then a formatter class is defined to convert the object of the class check to a binary stream.
Then a file stream object is created to open the file Example.txt in write mode to write the values of the properties identity and nam into it. Then serialize method is used to transfer the binary data into the text file. Finally, We use deserialize method to deserialize the contents of the text file Example.txt and the data is written to the console as shown in the output snapshot above.
? ??? C# ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











C#? ?? ??? ??????. ???? ?? ???? ?? ??, ?? ?? ? ?? ??? ??? ?? ?????.

?? ???? ????? ???? ?? ???? ??? ?? ???? ???? ??, ?? ???? ???? ?? ?????? ??? ????? ????. ?? ???? ??? ??? ? ??? ???? ????? ??? ?? ??? ?????. ?? ???? ??? ??? ??? ????? ???? ???? ??? UI ???? ???? ?? ????. ?? ??? ?? ????? ???? ?? ??? ??? ?? ????. ?? ??? ??? ?? ???? ???? ?? ???? ?? ???? UI ?? ?? ?????? ?? ???? ??? ?????.

C#? C? ??? ??? ???? ??? ??? ????. 1.C? 1983 ? Bjarnestroustrup? ?? ???? ?? ?? ?????? C ??? ??????. Evolution ?????? ?? ??? ?? ? Lambda Expressions ?? C 11, C 20 ?? ?? ? ? ??? ?? ?? ???? ???? ?? ?? ? ??? ?? ?????? ??? ? ????. 2.C#? 2000 ? Microsoft? ?? ?????? C? Java? ??? ???? ??? ???? ???? ??? ???. ?? ??, C#2.0? ???? C#5.0 ?? ? ??? ?????? ?????, ?? ?? ???? ??? ? ???? ???? ??? ? ????.

XML ??? ???? ???? ?? ??? ????. Notepad? ?? ??? ???? ???? ??; XMLBeautifier? ?? ??? ?? ???? XML ?? ??? ?? ??; XSLT? ?? XML ?? ??? ???? ?? ??? ?????. ?? Python? ?? ????? ??? ???? ?? ???? ?????. ?? ??? ???? ?? ? ???????.

C#? Palindrome ??????. ???? C#? ?? ?? ?? ??? ??? ??? ?? ??? ??? ?? ?????.
