[Obsolete("This function is obsolete, use Function2() instead")] void Function1() { // Function1 implementation } void Function2() { // Function2 implementation }
[Serializable] public class Person { public string Name { get; set; } public int Age { get; set; } } Person person = new Person { Name = "John", Age = 30 }; BinaryFormatter formatter = new BinaryFormatter(); MemoryStream stream = new MemoryStream(); formatter.Serialize(stream, person); byte[] serializedData = stream.ToArray();Package Library: `System.Runtime.Serialization.Formatters.dll`