

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
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
Represent Int64 as a Binary string in C#
To represent Int64 as a Binary string in C#, use the ToString() method and set the base as the ToString() method’s second parameter i.e. 2 for Binary.
Int64 represents a 64-bit signed integer.
Firstly, set an Int64 variable.
long val = 753458;
Now, convert it to binary string by including 2 as the second parameter.
Convert.ToString(val, 2)
Example
using System; class Demo { static void Main() { long val = 753458; Console.WriteLine("Long: "+val); Console.Write("Binary String: "+Convert.ToString(val, 2)); } }
Output
Long: 753458 Binary String: 10110111111100110010
- Related Questions & Answers
- Represent Int64 as a String in C#
- Represent Int64 as a Octal string in C#
- Represent Int64 as a Hexadecimal String in C#
- Represent Int32 as a Binary String in C#
- Represent Int32 as a String in C#
- Represent Int32 as a Hexadecimal String in C#
- Represent Int32 as a Octal String in C#
- Represent a Number as Sum of Minimum Possible Pseudo-Binary Numbers in C++
- Program to add two binary strings, and return also as binary string in C++
- Interchanging a string to a binary string in JavaScript
- Represent a number as a Sum of Maximum Possible Number of Prime Numbers in C++
- Find the winner of a game where scores are given as a binary string in Python
- Converting string to a binary string - JavaScript
- Binary Search a String in C++
- Int64.ToString() Method in C#
Advertisements