float b = 10.9f;int a;But the type that you are making type cast must be reference type such as object, primitive data type is not by reference but by value. So if you force using as like this example below it will give an error.
a = (int)b;
a = b as int;Kindly refer to this tutorial for other reference.
//Error:The as operator must be used with a reference type ('int' is a value type)
No comments:
Post a Comment