System.IO.Ports.InternalResources.GetMessage C# (CSharp) Méthode

GetMessage() static private méthode

static private GetMessage ( int errorCode ) : String
errorCode int
Résultat String
        internal static String GetMessage(int errorCode) 
        {
            StringBuilder sb = new StringBuilder(512);
            int result = SafeNativeMethods.FormatMessage(NativeMethods.FORMAT_MESSAGE_IGNORE_INSERTS |
                NativeMethods.FORMAT_MESSAGE_FROM_SYSTEM | NativeMethods.FORMAT_MESSAGE_ARGUMENT_ARRAY,
                new HandleRef(null, IntPtr.Zero), errorCode, 0, sb, sb.Capacity, IntPtr.Zero);
            if (result != 0) 
            {
                // result is the # of characters copied to the StringBuilder on NT,
                // but on Win9x, it appears to be the number of MBCS bytes.
                // Just give up and return the String as-is...
                String s = sb.ToString();
                return s;
            }
            else 
            {
                return SR.GetString(SR.IO_UnknownError, errorCode);
            }
        }