For example:

        public static MergeResultSafeHandle git_merge(RepositorySafeHandle repo, MergeHeadSafeHandle[] heads, GitMergeOptions options)
        {
            using (ThreadAffinity())
            {
                MergeResultSafeHandle ret;

                IntPtr[] their_heads = new IntPtr[heads.Length];
                for (int i = 0; i < heads.Length; i++)
                {
                    their_heads[i] = heads[i].DangerousGetHandle();
                }

                int res = NativeMethods.git_merge(
                    out ret,
                    repo,
                    their_heads,
                    their_heads.Length,
                    options);

                Ensure.ZeroResult(res);

                return ret;
            }
        }