guys..
if its ok... can somebody elaborate more about the casting in c#
=)
daghang salamat...
ben77 - with regards to your question you could refer to msdn for detailed explanations.
Casting (C#)
As what mark said c++ is more strict especially in casting thingy or in overall compare to c#. In c# you could do implicit and explicit casting while in c++ you must cast it explicitly.
Doing this is not logical.
Code:int x = 10 int y = 100 x = (int)y
@ben77, the was just mentioning the basic about cast... however you can refer to C++ cast, and compare it to C# Type Casting
here, I copied from my book:
very important details:
Since a value can be of more than one type, a use of the value needs to clearly identify which of its types is being used. Since values are read from locations that are typed, the type of the value which is used is the type of the location from which the value was read. If a different type is to be used, the value is cast to one of its other types. Casting is usually a compile time operation, but if the compiler cannot statically know that the value is of the target type, a runtime cast check is done. Unlike coercion, a cast never changes the actual type of an object nor does it change the representation. Casting preserves the identity of objects. For example, a runtime check might be needed when casting a value read from a location that is typed as holding a value of a particular interface. Since an interface is an incomplete description of the value, casting that value to be of a different interface type will usually result in a runtime cast check.
and don't forget to research about these:
Boxing and unboxing (rules in C#)
Enum (got some restriction regarding Cast)
castclass and isinst on value types ----> cast an object to a class
@MarkCuering
thanks a lot bro for the inputs....
dako na ug tabang sa ako....
di man gud ko masatisfy if dili maelaborate sa among titser ang kana mga discussions...
=)
ganahan lang ko mokutikoti kung asa na gikan ug ngano naingon ana na siya....
=)
how about deep codes? like parameters , many parameters?
after reading all the post....
![]()
Similar Threads |
|