Demo entry 6351106

Test

   

Submitted by anonymous on Mar 18, 2017 at 03:48
Language: C#. Code size: 1.1 kB.

public class OperationResult
{

    public bool IsSuccess()
    {
        return this.isSuccess;
    }

    public int GetErrorCode()
    {
        return this.errorCode;
    }

    public string ErrorMessage { get; private set; }

    private bool isSuccess;
    private int errorCode;

    public static readonly OperationResult Success
        = new OperationResult() { isSuccess = true, errorCode = 0,
                                    ErrorMessage = string.Empty };

    public static readonly OperationResult Warning
        = new OperationResult() { isSuccess = true, errorCode = 0,
                                    ErrorMessage = string.Empty };

    public static readonly OperationResult AccessDenied
        = new OperationResult() { isSuccess = false, errorCode = 4,
                                    ErrorMessage = "Access is denied." };

    public static readonly OperationResult DatabaseNotAvailable
        = new OperationResult() { isSuccess = false, errorCode = 17,
                                    ErrorMessage = "Database is not available." };

}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).