Most significant bits lost : Data Type Cast « Data Type « C# / CSharp Tutorial

C# / CSharp Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statement
5. String
6. struct
7. Class
8. Operator Overload
9. delegate
10. Attribute
11. Data Structure
12. Assembly
13. Date Time
14. Development
15. File Directory Stream
16. Preprocessing Directives
17. Regular Expression
18. Generic
19. Reflection
20. Thread
21. I18N Internationalization
22. GUI Windows Forms
23. 2D
24. Design Patterns
25. Windows
26. XML
27. ADO.Net
28. Network
29. Directory Services
30. Security
31. unsafe
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
C# / CSharp Tutorial » Data Type » Data Type Cast 
2. 49. 19. Most significant bits lost
using System;

class MainClass
{
   static void Main(string[] args)
   {
      ushort sh = 2000;
      byte sb;

      sb = unchecked((byte)sh);            
      Console.WriteLine("sb: {0}", sb);
   }
}
sb: 208
2. 49. Data Type Cast
2. 49. 1. Type Conversion in Expressions
2. 49. 2. Automatic Conversions
2. 49. 3. The use of the cast operator: how information loss can occur when explicitly converting a variable of one type to another
2. 49. 4. Automatic conversion from long to double
2. 49. 5. Cast an int into a double
2. 49. 6. Cast an int into a byte, no data lost
2. 49. 7. Cast an int into a byte, data lost
2. 49. 8. Cast a uint into a short, no data lost
2. 49. 9. Cast a uint into a short, data lost
2. 49. 10. Cast a long into a uint, no data lost
2. 49. 11. cast a long into a uint, data lost
2. 49. 12. Cast an int into a char
2. 49. 13. Cast byte back for byte calculation
2. 49. 14. Using casts in an expression.
2. 49. 15. Conversions of numeric types: checked and unchecked conversions
2. 49. 16. Conversions of numeric types: checked conversions block
2. 49. 17. Using checked and unchecked.
2. 49. 18. Using checked and unchecked with statement blocks.
2. 49. 19. Most significant bits lost
2. 49. 20. Raises the OverflowException exception
2. 49. 21. Get Type Code after casting
w_ww__.___j_av___a_2_s.c_o_m__ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.