System.IO.PathInternal.HasIllegalCharacters C# (CSharp) Méthode

HasIllegalCharacters() public static méthode

public static HasIllegalCharacters ( string path, bool checkAdditional ) : bool
path string
checkAdditional bool
Résultat bool
		public static bool HasIllegalCharacters (string path, bool checkAdditional)
		{
			return path.IndexOfAny (Path.InvalidPathChars) != -1;
		}
	}

Usage Example

Exemple #1
0
        /// <summary>
        /// Checks for invalid path characters in the given path.
        /// </summary>
        /// <exception cref="System.ArgumentNullException">Thrown if the path is null.</exception>
        /// <exception cref="System.ArgumentException">Thrown if the path has invalid characters.</exception>
        /// <param name="path">The path to check for invalid characters.</param>
        internal static void CheckInvalidPathChars(string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            if (PathInternal.HasIllegalCharacters(path))
            {
                throw new ArgumentException(SR.Argument_InvalidPathChars, nameof(path));
            }
        }
All Usage Examples Of System.IO.PathInternal::HasIllegalCharacters