예제 #1
0
        public AssemblyName(string assemblyName)
            : this()
        {
            if (assemblyName == null)
            {
                throw new ArgumentNullException(nameof(assemblyName));
            }
            if ((assemblyName.Length == 0) ||
                (assemblyName[0] == '\0'))
            {
                throw new ArgumentException(SR.Format_StringZeroLength);
            }

            AssemblyNameParser.AssemblyNameParts parts = AssemblyNameParser.Parse(assemblyName);
            _name    = parts._name;
            _version = parts._version;
            _flags   = parts._flags;
            if ((parts._flags & AssemblyNameFlags.PublicKey) != 0)
            {
                _publicKey = parts._publicKeyOrToken;
            }
            else
            {
                _publicKeyToken = parts._publicKeyOrToken;
            }

            if (parts._cultureName != null)
            {
                _cultureInfo = new CultureInfo(parts._cultureName);
            }
        }
예제 #2
0
 public static RuntimeAssemblyName Parse(string name)
 {
     AssemblyNameParser.AssemblyNameParts parts = AssemblyNameParser.Parse(name);
     return(new RuntimeAssemblyName(parts._name, parts._version, parts._cultureName, parts._flags, parts._publicKeyOrToken));
 }