System.AppDomain.AppDomain.ValidateAssemblyName C# (CSharp) Method

ValidateAssemblyName() private static method

private static ValidateAssemblyName ( string name ) : void
name string
return void
		private static void ValidateAssemblyName (string name)
		{
			if (name == null || name.Length == 0)
				throw new ArgumentException ("The Name of " +
					"AssemblyName cannot be null or a " +
					"zero-length string.");

			bool isValid = true;

			for (int i = 0; i < name.Length; i++) {
				char c = name [i];

				// do not allow leading whitespace
				if (i == 0 && char.IsWhiteSpace (c)) {
					isValid = false;
					break;
				}

				// do not allow /,\ or : in name
				if (c == '/' || c == '\\' || c == ':') {
					isValid = false;
					break;
				}
			}

			if (!isValid)
				throw new ArgumentException ("The Name of " +
					"AssemblyName cannot start with " +
					"whitespace, or contain '/', '\\' " +
					" or ':'.");
		}