System.GAC.AssemblyCache.GetPublicKey C# (CSharp) Method

GetPublicKey() public static method

public static GetPublicKey ( IAssemblyName name ) : byte[]
name IAssemblyName
return byte[]
        public static byte[] GetPublicKey(IAssemblyName name)
        {
            uint bufferSize = 512;
            IntPtr buffer = Marshal.AllocHGlobal((int) bufferSize);
            name.GetProperty(ASM_NAME.ASM_NAME_PUBLIC_KEY, buffer, ref bufferSize);
            byte[] result = new byte[bufferSize];
            for (int i = 0; i < bufferSize; i++)
                result[i] = Marshal.ReadByte(buffer, i);
            Marshal.FreeHGlobal(buffer);
            return result;
        }