コード例 #1
0
        public static void TestParse1()
        {
            const string x = "a";

            MetadataName name = MetadataName.Parse(x);

            Assert.Equal(x, name.ToString());
        }
コード例 #2
0
        private static AssemblyName CreateAssemblyName(MetadataName name, MetadataName culture, Version version, AssemblyNameFlags flags, byte[] publicKeyOrToken) {
            var result = new AssemblyName();

            result.Name = name.ToString();
            if (!culture.IsEmpty) {
                result.CultureInfo = new CultureInfo(culture.ToString());
            }

            result.Version = version;
            result.Flags = flags;

            if (publicKeyOrToken.Length != 0) {
                if ((result.Flags & AssemblyNameFlags.PublicKey) != 0) {
                    result.SetPublicKey(publicKeyOrToken);
                } else {
                    result.SetPublicKeyToken(publicKeyOrToken);
                }
            }

            return result;
        }