本文整理汇总了C#中System.Reflection.AssemblyName.SetPublicKey方法的典型用法代码示例。如果您正苦于以下问题:C# System.Reflection.AssemblyName.SetPublicKey方法的具体用法?C# System.Reflection.AssemblyName.SetPublicKey怎么用?C# System.Reflection.AssemblyName.SetPublicKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.AssemblyName
的用法示例。
在下文中一共展示了System.Reflection.AssemblyName.SetPublicKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAssemblyName
public System.Reflection.AssemblyName GetAssemblyName()
{
if(this.assemblyName == null)
{
System.Reflection.AssemblyName aName = new System.Reflection.AssemblyName();
aName.CultureInfo = new System.Globalization.CultureInfo(this.Culture == null ? "" : this.Culture);
if(this.PublicKeyOrToken != null && this.PublicKeyOrToken.Length > 8)
aName.Flags = System.Reflection.AssemblyNameFlags.PublicKey;
if((this.Flags & AssemblyFlags.Retargetable) != 0)
aName.Flags |= (System.Reflection.AssemblyNameFlags)AssemblyFlags.Retargetable;
aName.HashAlgorithm = System.Configuration.Assemblies.AssemblyHashAlgorithm.SHA1;
if(this.PublicKeyOrToken != null)
{
if(this.PublicKeyOrToken.Length > 8)
aName.SetPublicKey(this.PublicKeyOrToken);
else if(this.PublicKeyOrToken.Length > 0)
aName.SetPublicKeyToken(this.PublicKeyOrToken);
}
else
aName.SetPublicKey(new byte[0]);
aName.Name = this.Name;
aName.Version = this.Version;
switch(this.Flags & AssemblyFlags.CompatibilityMask)
{
case AssemblyFlags.NonSideBySideCompatible:
aName.VersionCompatibility = System.Configuration.Assemblies.AssemblyVersionCompatibility.SameDomain;
break;
case AssemblyFlags.NonSideBySideProcess:
aName.VersionCompatibility = System.Configuration.Assemblies.AssemblyVersionCompatibility.SameProcess;
break;
case AssemblyFlags.NonSideBySideMachine:
aName.VersionCompatibility = System.Configuration.Assemblies.AssemblyVersionCompatibility.SameMachine;
break;
}
this.assemblyName = aName;
}
return this.assemblyName;
}