Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

C# Bitwise Right Shift

using System;
 
namespace Operator
{
	class LeftShift
	{
		public static void Main(string[] args)
		{
			int number = 42;

			Console.WriteLine("{0}>>1 = {1}", number, number>>1);
			Console.WriteLine("{0}>>2 = {1}", number, number>>2);
			Console.WriteLine("{0}>>4 = {1}", number, number>>4);
		}
	}
}
Comment

Bitwise Left Shift C#

using System;
 
namespace Operator
{
	class LeftShift
	{
		public static void Main(string[] args)
		{
			int number = 42;

			Console.WriteLine("{0}<<1 = {1}", number, number<<1);
			Console.WriteLine("{0}<<2 = {1}", number, number<<2);
			Console.WriteLine("{0}<<4 = {1}", number, number<<4);
		}
	}
}
Comment

C# Bitwise and Bit Shift Operator

using System;
 
namespace Operator
{
	class BitOperator
	{
		public static void Main(string[] args)
		{
			int firstNumber = 10;
			int secondNumber = 20;
			int result;

			result = ~firstNumber;
			Console.WriteLine("~{0} = {1}", firstNumber, result);

			result = firstNumber & secondNumber;
			Console.WriteLine("{0} & {1} = {2}", firstNumber,secondNumber, result);

			result = firstNumber | secondNumber;
			Console.WriteLine("{0} | {1} = {2}", firstNumber,secondNumber, result);

			result = firstNumber ^ secondNumber;
			Console.WriteLine("{0} ^ {1} = {2}", firstNumber,secondNumber, result);

			result = firstNumber << 2;
			Console.WriteLine("{0} << 2 = {1}", firstNumber, result);

			result = firstNumber >> 2;
			Console.WriteLine("{0} >> 2 = {1}", firstNumber, result);
		}
	}
}
Comment

C# Bitwise Right Shift

using System;
 
namespace Operator
{
	class LeftShift
	{
		public static void Main(string[] args)
		{
			int number = 42;

			Console.WriteLine("{0}>>1 = {1}", number, number>>1);
			Console.WriteLine("{0}>>2 = {1}", number, number>>2);
			Console.WriteLine("{0}>>4 = {1}", number, number>>4);
		}
	}
}
Comment

Bitwise Left Shift C#

using System;
 
namespace Operator
{
	class LeftShift
	{
		public static void Main(string[] args)
		{
			int number = 42;

			Console.WriteLine("{0}<<1 = {1}", number, number<<1);
			Console.WriteLine("{0}<<2 = {1}", number, number<<2);
			Console.WriteLine("{0}<<4 = {1}", number, number<<4);
		}
	}
}
Comment

C# Bitwise and Bit Shift Operator

using System;
 
namespace Operator
{
	class BitOperator
	{
		public static void Main(string[] args)
		{
			int firstNumber = 10;
			int secondNumber = 20;
			int result;

			result = ~firstNumber;
			Console.WriteLine("~{0} = {1}", firstNumber, result);

			result = firstNumber & secondNumber;
			Console.WriteLine("{0} & {1} = {2}", firstNumber,secondNumber, result);

			result = firstNumber | secondNumber;
			Console.WriteLine("{0} | {1} = {2}", firstNumber,secondNumber, result);

			result = firstNumber ^ secondNumber;
			Console.WriteLine("{0} ^ {1} = {2}", firstNumber,secondNumber, result);

			result = firstNumber << 2;
			Console.WriteLine("{0} << 2 = {1}", firstNumber, result);

			result = firstNumber >> 2;
			Console.WriteLine("{0} >> 2 = {1}", firstNumber, result);
		}
	}
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: JsonConvert.DeserializeObject options camelcasing c# .net 
Csharp :: check file lock c# 
Csharp :: C# api get value from header 
Csharp :: LINQ: 2 join with group by 
Csharp :: finally c# code 
Csharp :: iterate though data in firebase unity 
Csharp :: c# dictionary get key by value 
Csharp :: Oculus Unity button press 
Csharp :: unity how to create a prefab 
Csharp :: c# null conditional operator if statement 
Csharp :: unity agent look at 
Csharp :: c# iterate sorteddictionary 
Csharp :: c# math method to reverse negative or positive 
Csharp :: how to fix on Input.GetMouseButtonDown(0) conting as ui 
Csharp :: get file name from stream c# 
Csharp :: c# list foreach lambda multiple actions 
Csharp :: print c# 
Csharp :: c# write line 
Csharp :: c# get smallest of 3 numbers 
Csharp :: c# .net automapper profile 
Csharp :: push c# array 
Csharp :: c# read excel file into datatable 
Csharp :: wpf textbox insert text at caret position 
Csharp :: unity rigidbody freeze rotation y z 
Csharp :: Startup.cs class is missing in .NET 6 
Csharp :: c sharp system pause equivelent 
Csharp :: get first number in string C# 
Csharp :: unity stop physics 
Csharp :: convert word files to plain text c# 
Csharp :: how to use open hardware monitor in c# 
ADD CONTENT
Topic
Content
Source link
Name
9+8 =