tagged [operators]

practical applications of bitwise operations

practical applications of bitwise operations 1. What have you used bitwise operations for? 2. why are they so handy? 3. can someone please recommend a VERY simple tutorial?

7 Oct at 15:44

Why does >= return false when == returns true for null values?

Why does >= return false when == returns true for null values? I have two variables of type int? (or Nullable if you will). I wanted to do a greater-than-or-equal (>=) comparison on the two variables ...

9 Dec at 16:36

why -3==~2 in C#

why -3==~2 in C# Unable to understand. Why output is "equal"

What does the "&=" in this C# code do?

What does the "&=" in this C# code do? I came across some code that looks like this: Why would I use the bitwise operator instead of "="?

29 Dec at 16:56

Greater than and less than in one statement

Greater than and less than in one statement I was wondering, do you have a neat way of doing this ? ``` if(orderBean.getFiles().size() > 0 && orderBean.getFiles().size() 0 && filesCount

10 Jan at 12:40

IS NOT operator in C#

IS NOT operator in C# I can't find the "is not" operator in C#. For example I have the code below which does not work. I need to check that `err` is not of type class `ThreadAbortException`.

18 Jan at 17:19

Is relying on && short-circuiting safe in .NET?

Is relying on && short-circuiting safe in .NET? Assume myObj is null. Is it safe to write this? I know some languages won't execute the second expression because the && evaluates to false before the ...

Python's 'in' operator equivalent to C#

Python's 'in' operator equivalent to C# With Python, I can use 'in' operator for set operation as follows : What's the equivalent in C#?

16 Feb at 03:27

Does c# ?? operator short circuit?

Does c# ?? operator short circuit? When using the `??` operator in C#, does it short circuit if the value being tested is not null? Example: Does the test3 line succeed or throw a null reference excep...

15 Mar at 22:36

Operator overloading?

Operator overloading? I've made myself a rss reader that keeps me up to date and informs me on new shows, or atleast thats the thought behind. I've made a struct "SeasonEpisode" that hold two ints (se...

15 Apr at 06:6

Does anyone know of a .NET enum of Comparison Operators in System or System.Core?

Does anyone know of a .NET enum of Comparison Operators in System or System.Core? Is there an enum in System or System.Core that has all the ComparisonOperators? I just wrote the following enum, but i...

programmatically specify operator

programmatically specify operator Is it possible to specify an operator `R` where `R` can be an arithmetic, relational or logical operator ? For example a function that calculates where I can specify ...

9 May at 19:41

proper name for python * operator?

proper name for python * operator? What is the correct name for operator `*`, as in `function(*args)`? unpack, unzip, something else?

17 May at 02:35

VB.NET vs C# integer division

VB.NET vs C# integer division Anyone care to explain why these two pieces of code exhibit different results? VB.NET v4.0 C# v4.0

17 May at 04:16

xor with 3 values

xor with 3 values I need to do an xor conditional between 3 values, ie i need one of the three values to be true but not more than one and not none. I thought i could use the xor ^ operator for this b...

3 Jun at 14:19

No increment operator in VB.net

No increment operator in VB.net I am fairly new to vb.net and came across this issue while converting a for loop in C# to VB.net I realized that the increment operators are not available in vb.net (++...

14 Jun at 05:24

C# interface cannot contain operators

C# interface cannot contain operators Can anyone please explain why C# interfaces are not allowed to contain operators? Thanks.

Operator '=' chaining in C# - surely this test should pass?

Operator '=' chaining in C# - surely this test should pass? I was just writing a property setter and had a brain-wave about why we don't have to `return` the result of a `set` when a property might be...

12 Jul at 16:1

Why are Postfix ++/-- categorized as primary Operators in C#?

Why are Postfix ++/-- categorized as primary Operators in C#? Currently I'm teaching a class of C++ programmers the basics of the C# language. As we discussed the topic operators I used C# standard ca...

How do I perform explicit operation casting from reflection?

How do I perform explicit operation casting from reflection? I want to use reflection and do either an implicit or explicit coversion using reflection. Given I have defined Foo this way ``` public cla...

C# Error: The call is ambiguous between the following methods or properties. Overloading operators

C# Error: The call is ambiguous between the following methods or properties. Overloading operators I have 2 classes with overloaded operators in a namespace called Dinero, these are the 2 classes: Fir...

How to verify whether a type overloads/supports a certain operator?

How to verify whether a type overloads/supports a certain operator? How can I check whether a certain type implements a certain operator? ``` struct CustomOperatorsClass { public int Value { get; pr...

15 Dec at 16:9

Using the ternary operator for multiple operations

Using the ternary operator for multiple operations How can I use the ternary `? :` condition to perform multiple operations, if expression is true/false? `wbsource = (exp) ? (Do one thing) : (Do secon...

8 Mar at 11:14

What is the instanceof operator in JavaScript?

What is the instanceof operator in JavaScript? The `instanceof` keyword in JavaScript can be quite confusing when it is first encountered, as people tend to think that JavaScript is not an object-orie...

10 Apr at 20:46

Difference between "and" and && in Ruby?

Difference between "and" and && in Ruby? What is the difference between the `&&` and `and` operators in Ruby?

18 May at 05:58