/// <summary> /// Converts <see cref="IAssemblyName"/> to <see cref="AssemblyName"/> with possibly missing name components. /// </summary> /// <returns> /// An <see cref="AssemblyName"/> whose fields are be null if not present in <paramref name="nameObject"/>. /// </returns> internal static AssemblyName ToAssemblyName(FusionAssemblyIdentity.IAssemblyName nameObject) { var result = new AssemblyName(); result.Name = FusionAssemblyIdentity.GetName(nameObject); result.Version = FusionAssemblyIdentity.GetVersion(nameObject); var cultureName = FusionAssemblyIdentity.GetCulture(nameObject); result.CultureInfo = (cultureName != null) ? new CultureInfo(cultureName) : null; byte[] publicKey = FusionAssemblyIdentity.GetPublicKey(nameObject); if (publicKey != null && publicKey.Length != 0) { result.SetPublicKey(publicKey); } else { result.SetPublicKeyToken(FusionAssemblyIdentity.GetPublicKeyToken(nameObject)); } result.Flags = FusionAssemblyIdentity.GetFlags(nameObject); result.ContentType = FusionAssemblyIdentity.GetContentType(nameObject); return(result); }