// Create a new SerializationInfo object SerializationInfo info = new SerializationInfo(typeof(MyClass), new FormatterConverter()); // Add a 64-bit integer to the SerializationInfo object info.AddValue("MyInt64", 123456789L); // Retrieve the 64-bit integer from the SerializationInfo object long myInt64 = info.GetInt64("MyInt64");
[Serializable] public class MyClass : ISerializable { public long MyInt64; public MyClass() { } protected MyClass(SerializationInfo info, StreamingContext context) { MyInt64 = info.GetInt64("MyInt64"); } public void GetObjectData(SerializationInfo info, StreamingContext context) { info.AddValue("MyInt64", MyInt64, typeof(long)); } }In this example, we define a serializable class called MyClass that implements the ISerializable interface. We define a member variable of type long, and also define two methods: one for deserializing an object (`protected MyClass(SerializationInfo info, StreamingContext context)`), and one for serializing an object (`public void GetObjectData(SerializationInfo info, StreamingContext context)`). Within the deserialization method, we use the GetInt64 method to retrieve the value of a 64-bit integer stored in the SerializationInfo object. Overall, the System.Runtime.Serialization.SerializationInfo.GetInt64 method is primarily used for deserializing objects and retrieving values that were stored during serialization. It is part of the .NET Framework Class Library.