Conversion Operators
In the previous section we discussed converting between value types and reference types. Such kinds of conversions are not the only ones allowed by the .NET Framework because you often need to perform conversions between two value types or two reference types. For example, imagine that you want to represent a number as a text message. In such a case, you need to convert an Integer into a String; you could also have an Integer value that must be passed to a method that instead receives an argument of type Double. Another common scenario is when you work with user controls in the user interface. There are some controls such as ListBox and DataGridView on the Windows side or the DataGrid on the web side that can store any ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access