AssemblyName.GetPublicKey Method ()

 

Gets the public key of the assembly.

Namespace:   System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

member GetPublicKey : unit -> byte[]

Return Value

Type: System.Byte[]

A byte array that contains the public key of the assembly.

Exception Condition
SecurityException

A public key was provided (for example, by using the SetPublicKey method), but no public key token was provided.

The following example emits a dynamic assembly and saves it to the current directory. When the assembly is created, the SetPublicKey method is used to give the assembly a public key. The GetPublicKey method is then used to retrieve the public key, which is displayed to the console.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: