![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert.ToUInt16 Method in C#
Use the Convert.ToUInt16 method to convert a specified value to a 16-bit unsigned integer.
Here is our string −
string str = "1129";
Now let us convert it to 16-bit unsigned integer.
ushort res; res = Convert.ToUInt16(str);
The following is the complete example −
Example
using System; public class Demo { public static void Main() { string str = "1307"; ushort res; res = Convert.ToUInt16(str); Console.WriteLine("Converted string '{0}' to {1}", str, res); } }
Output
Converted string '1307' to 1307
Advertisements