Skip to main content

TYPE CASTING in C#

Type casting is a process in which you will convert one type of data into another type of data
  1. Implicit Type Casting
  2. Explicit Type Casting
Implicit Type Casting
Implicit type casting is the casting which is done by your CLR of compiler. In this type of casting it will itself convert one type into another type. But the only condition is that the conversion must be compatible.
Example
Int x = 5;
Float y = 6f;
y=x;
Explicit Type Casting
Explicit is the process in which we manually convert the one type of data into another type of data. But there is a chance of data loss in type of explicit type of casting. Apart from this the data type must be compatible.

Comments

Popular posts from this blog

Export html table to csv using javascript

<table>     <tr><th>Name</th><th>Age</th><th>Country</th></tr>     <tr><td>MANOJ</td><td>26</td><td>INDIA</td></tr>     <tr><td>KRISHAN</td><td>19</td><td>INDIA</td></tr>     <tr><td>SUSHEEL</td><td>32</td><td>INDIA</td></tr> </table> <button onclick="Export_CSV ()">Export HTML table to CSV file</button> function download_csv(csv, filename) {     var csvFile;     var downloadLink;     csvFile = new Blob([csv], {type: "text/csv"});     downloadLink = document.createElement("a");     downloadLink.download = filename;     downloadLink.href = window.URL.createObjectURL(csvFile);     downloadLink.style.d...

Sql CharIndex Function

The CHARINDEX  function returns the starting position of the specified expression in a character string. Example: Search for "t" in string "DotNetReceipe", and return position: SELECT CHARINDEX( 't' , 'DotNetReceipe' ) AS Position;