Beispiel #1
0
        private static IList <string> BuildListOf(UnSafeNativeMethods.git_strarray strArray)
        {
            var list = new List <string>();

            try
            {
                UnSafeNativeMethods.git_strarray *gitStrArray = &strArray;

                uint numberOfEntries = gitStrArray->size;
                for (uint i = 0; i < numberOfEntries; i++)
                {
                    var name = (string)marshaler.MarshalNativeToManaged((IntPtr)gitStrArray->strings[i]);
                    list.Add(name);
                }

                list.Sort(StringComparer.Ordinal);
            }
            finally
            {
                UnSafeNativeMethods.git_strarray_free(ref strArray);
            }

            return(list);
        }
        private static IList <string> BuildListOf(UnSafeNativeMethods.git_strarray strArray)
        {
            var list = new List <string>();

            try
            {
                UnSafeNativeMethods.git_strarray *gitStrArray = &strArray;

                int numberOfEntries = gitStrArray->size.ToInt32();
                for (uint i = 0; i < numberOfEntries; i++)
                {
                    var name = new string(gitStrArray->strings[i]);
                    list.Add(name);
                }

                list.Sort(StringComparer.Ordinal);
            }
            finally
            {
                UnSafeNativeMethods.git_strarray_free(ref strArray);
            }

            return(list);
        }