4
I’m using the Mono compiler. When I tried to compile this:
using static System.Globalization.CharUnicodeInfo;
using static System.Globalization.UnicodeCategory;
namespace AS3Kit.Lexical
{
static class Validator
{
static bool TestCategory(UnicodeCategory cat, int cp)
{ return CharUnicodeInfo.GetUnicodeCategory(cp) == cat; }
// ...
}
}
Error
D: hydroper local work Cs As3kit>mcs -recurse:source/*. Cs -out:As3kit.exe source Lexical Validator.Cs(8,28): error CS0246: The type or namespace name
Uni codeCategory' could not be found. Are you missing
System.Globalization' using d irective? Compilation failed: 1 error(s), 0 warnings
What do you mean, the guy UnicodeCategory
does not exist. However, if we visit the Github repository, we can see that Enum System.Globalization.UnicodeCategory
(C#CLI) has been implemented. So why does the compiler not find :v ?
So I did a lot of things wrong :
using static
is a little different fromimport static
java...– Klaider
@Hogenesis They have the same purpose. The two serve to access the static members directly, without writing their class name before.
– Gabriel