Пример #1
0
    public static void Main()
    {
        MyControl myControl = new MyControl();

        ISerializable ser = (ISerializable)myControl;

        // NOTE: This will throw a System.InvalidateCastException
        // because the class does not implement the ISerializable
        // interface.
        bool success = ser.Save();

        Console.WriteLine("The saving of '{0}' was {1}successful",
                          myControl.data,
                          (true == success ? "" : "not "));
    }