 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- 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
                    