c# - Why must write O AS INT and can't write (INT)O -
I like to use the as operator in John Skeet's book with such a type Example found, which allows the zero value. I can not understand why I can not write Because checking first cast Types are not variable for each other, then it only gives zero and avoids When you are passing a string in the second call in the second call, which is not variable for
using the system; Class A {static white printAUscient 32 (object o) {int? O; as nullable = int ;; Can not write // int? Nullable = (int?) O console Wrightite (nullable.HasValue? Nullable.Value.ToString (): "Zero"); } Fixed zero main () {PrintValueAsInt32 (5); PrintValueAsInt32 ("some string"); }}
int? Nullable = (int?) O ? When I try to do this, I'm getting an exception.
invalid cut exception .
int, then try to use the clear artist Time Receiving an Exception
Comments
Post a Comment