24
Po uaktualnieniu do VS 2017 Mam następujący błąd z tego kodu (który zawsze działa idealnie)VS 2017 Błąd lub nowe funkcje?
byte[] HexStringToByteArray(string hex)
{
if (hex.Length % 2 == 1)
throw new Exception("The binary key cannot have an odd number of digits");
byte[] arr = new byte[hex.Length >> 1];
for (int i = 0; i <hex.Length>> 1; ++i) // Error in this line
{
arr[i] = (byte)((GetHexVal(hex[i << 1]) << 4) + (GetHexVal(hex[(i << 1) + 1])));
}
return arr;
}
wyjątek:
Error 1: The variable 'i' cannot be used with type arguments
Error 2: 'hex' is a variable but is used like a type
Roztwór otoczyć wyrażenie w nawiasie.
for (int i = 0; i < (hex.Length >> 1); ++i)
Ale to mnie zastanowiło, czy to błąd, czy nowa funkcjonalność? Dzięki.
cokolwiek to jest rozwiązanie wygląda o wiele czystsze kod. – bansi
To błąd, dość duży. [Należy tu] (https://github.com/dotnet/roslyn/issues), kliknij przycisk Nowy problem. –
Możliwy duplikat błędu [Błąd kompilatora: "błąd CS0307: Zmienna" int "nie może być używana z argumentami typu"] (http://stackoverflow.com/questions/39669720/compiler-error-error-cs0307-the-variable- int-can-be-used-with-type-argum) – NineBerry