Casting is a way of telling the compiler “Object X is really Type Y, go ahead and treat it as such.”
Conversion is saying “I know Object X isn’t Type Y, but there exists a way of creating a new Object from X of Type Y, go ahead and do it.”
More Related Contents:
- Does it make sense to use “as” instead of a cast even if there is no null check? [closed]
- convert double to int
- Cast class into another class or convert class to another
- Invalid cast from ‘System.Int32’ to ‘System.Nullable`1[[System.Int32, mscorlib]]
- Cannot Implicitly Convert int to int[] [closed]
- Convert string[] to Array
- How to convert numbers between hexadecimal and decimal
- Setting a property by reflection with a string value
- Is it possible to assign a base class object to a derived class reference with an explicit typecast?
- Cast List to List
- Generics and casting – cannot cast inherited class to base class
- How to convert a gi-normous integer (in string format) to hex format? (C#)
- string = string + int: What’s behind the scenes?
- Difference between Convert.ToString() and .ToString()
- Difference between casting and using the Convert.To() method
- Error on if statement – cannot implicitly convert type to ‘bool’
- Is the behaviour of casting a negative double to unsigned int defined in the C standard? Different behaviour on ARM vs. x86
- How do I cast int to enum in C#?
- Fast way to convert a two dimensional array to a List ( one dimensional )
- Int to Char in C#
- Specifying generic collection type param at runtime [duplicate]
- C# Cast Entire Array?
- Why does the Linq Cast helper not work with the implicit cast operator?
- Converting an int[] to byte[] in C#
- Why is a SQL float different from a C# float
- Converting String To Float in C#
- Is casting the same thing as converting?
- C# unsafe value type array to byte array conversions
- Why does null need an explicit type cast here? [duplicate]
- Why is a cast required for byte subtraction in C#? [duplicate]