# C#
// Create a byte array containing the strong name public key
// data.
byte[] publickey = { 0, 36, 0, 0, 4, 128, 0, 0, 148,
0, 0, 0, 6, 2, 0, 0, 0, 36, 0, 0, 82, 83, 65, 49, 0, 4, 0,
0, 1, 0, 1, 0, 169, 206, 164, 8, 66, 197, 231, 138, 148, 74,
99, 125, 171, 203, 120, 143, 240, 155, 104, 138, 4, 123, 15,
55, 85, 255, 183, 20, 111, 10, 217, 58, 127, 15, 236, 86, 16,
121, 222, 35, 161, 14, 122, 246, 85, 226, 162, 221, 46, 215,
161, 151, 183, 38, 31, 150, 198, 119, 109, 94, 11, 65, 208,
33, 122, 172, 106, 62, 192, 4, 35, 255, 220, 10, 43, 90, 92,
183, 29, 136, 57, 235, 30, 5, 127, 72, 210, 108, 215, 226, 65,
197, 184, 28, 129, 184, 191, 211, 159, 69, 8, 84, 116, 65, 186,
179, 35, 116, 174, 223, 167, 217, 116, 8, 178, 232, 213, 155,
172, 87, 181, 187, 61, 43, 133, 105, 10, 187 };
// Create a StrongNamePublicKeyBlob object from the
// public key byte array.
StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob(publickey);
// Create a Version object based on the assembly version
// number
Version version = new Version("1.1578.0.0");
// Create the new StrongNameMembershipCondition
StrongNameMembershipCondition mc =
new StrongNameMembershipCondition (blob, "HelloWorld", version);
// Create a new application domain policy level
PolicyLevel p = PolicyLevel.CreateAppDomainLevel( );
// Add the StrongNameMembershipCondition to the fully trusted
// assembly list
p.AddFullTrustAssembly(mc);
# Visual Basic .NET
' Create a byte array containing the strong name public key
' data.
Dim publickey( ) As Byte = { 0, 36, 0, 0, 4, 128, 0, 0, 148, _
0, 0, 0, 6, 2, 0, 0, 0, 36, 0, 0, 82, 83, 65, 49, 0, 4, 0, _
0, 1, 0, 1, 0, 169, 206, 164, 8, 66, 197, 231, 138, 148, 74, _
99, 125, 171, 203, 120, 143, 240, 155, 104, 138, 4, 123, 15, _
55, 85, 255, 183, 20, 111, 10, 217, 58, 127, 15, 236, 86, 16, _
121, 222, 35, 161, 14, 122, 246, 85, 226, 162, 221, 46, 215, _
161, 151, 183, 38, 31, 150, 198, 119, 109, 94, 11, 65, 208, _
33, 122, 172, 106, 62, 192, 4, 35, 255, 220, 10, 43, 90, 92, _
183, 29, 136, 57, 235, 30, 5, 127, 72, 210, 108, 215, 226, 65, _
197, 184, 28, 129, 184, 191, 211, 159, 69, 8, 84, 116, 65, 186, _
179, 35, 116, 174, 223, 167, 217, 116, 8, 178, 232, 213, 155, _
172, 87, 181, 187, 61, 43, 133, 105, 10, 187}
' Create a StrongNamePublicKeyBlob object from the
' publickey byte array.
Dim blob As StrongNamePublicKeyBlob = New StrongNamePublicKeyBlob(publickey)
' Create a Version object based on the assembly version
' number
Dim version As Version = New Version("1.1578.0.0")
' Create the new StrongNameMembershipCondition
Dim mc As StrongNameMembershipCondition = _
New StrongNameMembershipCondition(blob,"HelloWorld",version)
' Create a new application domain policy level
Dim p As PolicyLevel = PolicyLevel.CreateAppDomainLevel( )
' Add the StrongNameMembershipCondition to the fully trusted
' assembly list
p.AddFullTrustAssembly(mc)
|