Ejemplo n.º 1
0
 /// <summary>
 /// Create a new instance of the <see cref="NativeError" /> class.
 /// </summary>
 /// <param name="number">the error number for the native error</param>
 /// <returns>
 /// An instance of the <see cref="NativeError" /> class for the specified
 /// error number.
 /// </returns>
 /// <remarks>
 /// <para>
 /// The message for the specified error number is lookup up using the
 /// native Win32 <c>FormatMessage</c> function.
 /// </para>
 /// </remarks>
 public static NativeError GetError(int number)
 {
     return(new NativeError(number, NativeError.GetErrorMessage(number)));
 }
Ejemplo n.º 2
0
        public static NativeError GetLastError()
        {
            int number = Marshal.GetLastWin32Error();

            return(new NativeError(number, NativeError.GetErrorMessage(number)));
        }