There is no concept of a global exception code in .NET -- and there really could never be, since it implies that every author of every exception class on the planet would have to collaborate in order to choose codes.
You also cannot assume that a particular message signals an exception of a particular type, since the message can (in the general case) be freely chosen at the throw site.
You could do a type switch on exception.GetType() to find what the runtime type of an exception is, but that is not guaranteed to be a solution (it depends on what was actually thrown, which could be a vanilla System.Exception for all we know).
What exactly are you trying to achieve?