Anvas has the right idea, but .NET provides two methods which return the illegal characters for a file and a path, which you should use instead of defining your own:
GetInvalidPathChars [
^]
GetInvalidFileNameChars[
^]
if (myFileName.IndexOfAny(Path.GetInvalidFileNameChars()) != -1)
{
}
Using these provides better portability than specifying your own.