Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,924 questions

51,857 answers

573 users

How to separate groups of digits in numeric literals with underscore in C#

4 Answers

0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		long creditCardNumber = 1234_5678_9101_1129L;
		
		Console.WriteLine("Credit Card Number: " + creditCardNumber);
	}
}



/*
run:
  
Credit Card Number: 1234567891011129
  
*/

 



answered Aug 1, 2022 by avibootz
0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		float pi =  3.14_15_92F;
         
        Console.WriteLine("PI: " + pi);
	}
}



/*
run:
  
PI: 3.141592
  
*/

 



answered Aug 1, 2022 by avibootz
0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		long hexLong = 0x5F_3A_DE_BD;
         
        Console.WriteLine("Hex long: " + hexLong);
	}
}



/*
run:
  
Hex long: 1597693629
  
*/

 



answered Aug 1, 2022 by avibootz
0 votes
using System;

public class Program
{
	public static void Main(string[] args)
	{
		byte binByte = 0b0010_0111;
         
        Console.WriteLine("binByte: " + binByte);
	}
}



/*
run:
  
binByte: 39
  
*/

 



answered Aug 1, 2022 by avibootz

Related questions

1 answer 148 views
1 answer 161 views
1 answer 201 views
1 answer 173 views
1 answer 86 views
2 answers 206 views
206 views asked Feb 26, 2015 by avibootz
...