Beispiel #1
0
    private void EmptyConstructor()
    {
        // Construct a CryptographicUnexpectedOperationException
        // with no parameters.
        CryptographicUnexpectedOperationException cryptographicException =
            new CryptographicUnexpectedOperationException();

        Console.WriteLine("Created an empty " +
                          "CryptographicUnexpectedOperationException.");
    }
Beispiel #2
0
    private void StringConstructor()
    {
        // Construct a CryptographicUnexpectedOperationException
        // using a custom error message.
        string errorMessage = ("Unexpected operation exception.");
        CryptographicUnexpectedOperationException cryptographicException =
            new CryptographicUnexpectedOperationException(errorMessage);

        Console.WriteLine("Created a " +
                          "CryptographicUnexpectedOperationException with the following " +
                          " error message: " + errorMessage);
    }
Beispiel #3
0
    private void setSerializationInfo(
        ref CryptographicUnexpectedOperationException ex)
    {
        // Insert information about the exception into a serialized object.
        FormatterConverter formatConverter   = new FormatterConverter();
        SerializationInfo  serializationInfo =
            new SerializationInfo(ex.GetType(), formatConverter);
        StreamingContext streamingContext =
            new StreamingContext(StreamingContextStates.All);

        ex.GetObjectData(serializationInfo, streamingContext);
    }
Beispiel #4
0
    private void StringStringConstructor()
    {
        // Create a CryptographicUnexpectedOperationException using a time
        // format and the current date.
        string dateFormat = "{0:t}";
        string timeStamp  = (DateTime.Now.ToString());
        CryptographicUnexpectedOperationException cryptographicException =
            new CryptographicUnexpectedOperationException(
                dateFormat, timeStamp);

        Console.WriteLine("Created a " +
                          "CryptographicUnexpectedOperationException with (" + dateFormat +
                          ") as the format and (" + timeStamp + ") as the message.");
    }
Beispiel #5
0
    private void StringExceptionConstructor()
    {
        // Construct a CryptographicUnexpectedOperationException using a
        // custom error message and an inner exception.
        string errorMessage = ("The current operation is not supported.");
        NullReferenceException nullException = new NullReferenceException();
        CryptographicUnexpectedOperationException cryptographicException =
            new CryptographicUnexpectedOperationException(
                errorMessage, nullException);

        Console.WriteLine("Created a " +
                          "CryptographicUnexpectedOperationException with the following" +
                          "error message: " + errorMessage + " and inner exception: "
                          + nullException.ToString());
    }