System.Globalization.IdnMapping.GetAsciiCore C# (CSharp) Метод

GetAsciiCore() приватный Метод

private GetAsciiCore ( char unicode, int count ) : string
unicode char
count int
Результат string
        private unsafe string GetAsciiCore(char* unicode, int count)
        {
            uint flags = Flags;

            // Determine the required length
            int length = Interop.Normaliz.IdnToAscii(flags, new IntPtr(unicode), count, IntPtr.Zero, 0);
            if (length == 0)
            {
                ThrowForZeroLength(nameof(unicode), SR.Argument_IdnIllegalName, SR.Argument_InvalidCharSequenceNoIndex);
            }

            // Do the conversion
            const int StackAllocThreshold = 512; // arbitrary limit to switch from stack to heap allocation
            if (length < StackAllocThreshold)
            {
                char* output = stackalloc char[length];
                return GetAsciiCore(unicode, count, flags, output, length);
            }
            else
            {
                char[] output = new char[length];
                fixed (char* pOutput = output)
                {
                    return GetAsciiCore(unicode, count, flags, pOutput, length);
                }
            }
        }

Same methods

IdnMapping::GetAsciiCore ( char unicode, int count, uint flags, char output, int outputLength ) : string