+ 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!

29th Sep 2021, 5:35 PM
Kamil Hamid
Kamil Hamid - avatar
11 ответов
+ 3
29th Sep 2021, 6:13 PM
Rellot's screwdriver
Rellot's screwdriver - avatar
+ 2
Maybe you should continue the c# course and find out.
29th Sep 2021, 5:42 PM
Simon Sauter
Simon Sauter - avatar
+ 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.
30th Sep 2021, 2:54 PM
Simon Sauter
Simon Sauter - avatar
+ 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.
30th Sep 2021, 6:32 PM
Arun Jamson
Arun Jamson - avatar
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
29th Sep 2021, 5:45 PM
Kamil Hamid
Kamil Hamid - avatar
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
29th Sep 2021, 5:52 PM
Kamil Hamid
Kamil Hamid - avatar
0
Thank you @Rellot's screwdriver
29th Sep 2021, 6:20 PM
Kamil Hamid
Kamil Hamid - avatar
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.
29th Sep 2021, 6:20 PM
Simon Sauter
Simon Sauter - avatar
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
30th Sep 2021, 6:45 AM
Kamil Hamid
Kamil Hamid - avatar
0
Simon Sauter Thank you
30th Sep 2021, 3:07 PM
Kamil Hamid
Kamil Hamid - avatar
29th Sep 2021, 5:50 PM
Simon Sauter
Simon Sauter - avatar