Is int assignable from char?

I note that

int number = 'a';

Is an expression about C # language

But what expression

typeof(int).IsAssignableFrom(typeof(char))

Returns false. Isn't that a contradiction?

+5
source share
2 answers

Isn't that a contradiction?

Nope. C # provides an implicit conversion from charto int, but if you look at the documentation for Type.IsAssignableFrom, it will point for the return value:

true, c , c, , c , c current Type c, c , Nullable<c>. false, , c null.

, false.

+13

, , . #, , , CLR.

+1

All Articles