You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
according to MSDN
Encoding.GetEncoding(string)
exceptions:
ArgumentException
name is not a valid code page name.
-or-
The code page indicated by name is not supported by the underlying platform.
And I need only 3 encodings... not the whole list of supported encodings.
2) Sorry, but need to have TWO diffrent builds of the same assembly is a really bad idea. My software can work on Windows (.net 2.0) or Linux (Mono 2.*) on the same build.
I think, it's better to use runtime check instread of compilation directives.
public static Boolean IsRunningOnLinux()
{
var p = (int)Environment.OSVersion.Platform;
return (p == 4) || (p == 128);
}
public static Boolean IsRunningOnMono\(\)
\{
return Type\.GetType\("Mono\.Runtime"\) \!= null;
\}
We have to have Mono build, because some parts of code are not working there. The runtime check isn't enough, in some parts we need to know this during compile time. If you need to use it on Mono and on http://MS.NET, use MONO directive. It's compatible with http://MS.NET.
Submitted by: Konstantin Dombrugov (abracadabra)
probably, it would be better to try\catch AgrumentException while executing default case in GetEncoding private method
The text was updated successfully, but these errors were encountered: