C# Casting and Type Conversions

  1. Implicit conversions: No data is lost. Lower range numeric type to higher range numeric type

    And derived class to base class

  1. Explicit cast: There is always a chance of data loss. It is applied in cases opposite to implicit conversions
  2. User Defined conversions: Conversion operators can be explicit or implicit. Implicit conversion operators are easier to use, but explicit operators are useful when you want users of the operator to be aware that a conversion is taking place.
  3. Conversions with the help of helper class: They are basically used with the help of System.BitConverter class.

Leave a Reply

Your email address will not be published. Required fields are marked *