+ 1
Operators in C#
Hi, I'm currently unsure of the following operators in C#: & | ^ >> << What exactly are these? What do they do when they interact with numbers, booleans, and strings (or char)? For example, why does this input 1: int x=5; x &=3; Console.WriteLine(x); And of course what about the other operators? Thank you in advance!
11 Answers
+ 3
Microsoft Documentation is probably a good place to know about it
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators
+ 2
Maybe you should continue the c# course and find out.
+ 1
Kamil Hamid I'm sorry if I offended you and you really tried to find the information yourself and just didn't find what you needed. Unfortunately there are *a lot* of people who post questions here without putting in any kind of effort. Questions that could easily be resolved with a quick search. Sorry again.
+ 1
C# provides a number of operators. Many of them are supported by the built-in types and allow you to perform basic operations with values of those types. Those operators include the following groups:
Arithmetic operators that perform arithmetic operations with numeric operands
Comparison operators that compare numeric operands Boolean logical operators that perform logical operations with bool operands
Bitwise and shift operators that perform bitwise or shift operations with operands of the integral types
Equality operators that check if their operands are equal or not.Typically, you can overload those operators, that is, specify the operator behavior for the operands of a user-defined type.
The simplest C# expressions are literals (for example, integer and real numbers) and names of variables. You can combine them into complex expressions by using operators. Operator precedence and associativity determine the order in which the operations in an expression are performed.
0
@Simon Sauter,
I am currently looking on a different source and will eventually get onto this course, however I would appreciate if I could know. I could not find the answer which explains in a way I understand online, and I wish to know now to help with my CURRENT progression
0
@Simon Sauter,
I am afraid that doesn't help me find something which shows me when I have typed this question into a search engine
0
Thank you @Rellot's screwdriver
0
I find the information easily and quickly with a simple Google search, but OK. I realise that googling goes beyond some people's capabilities.
0
Simon Sauter
I donât see why you have to be so offensive in messaging. Please can you appreciate that not all information is readily available. Search engines are not magical and donât have everything which is very easy to find and not on the tenth search page
0
Simon Sauter
Thank you
- 1
In that case:
https://www.wikihow.com/Search-the-Internet