Skip to main content

All Questions

Tagged with
0 votes
1 answer
70 views

Concatenate String and Is Operator

I do not understand why this code does throw a nullref. I think it has something to do with the priority of the 'plus' operator and the 'is' operator but I am really not sure why. return "...
jeb's user avatar
  • 1,194
0 votes
1 answer
42 views

Reading the values out of an expression string, while keeping the formula intact

I have some code with mathematical operations, and I'm trying to make them easier to read and debug. But a very particular case is becoming complex, here's an example: public int val1=1; public int ...
desiredness's user avatar
-1 votes
1 answer
79 views

perform calculation based on the operator passed as method parameter [closed]

I'm trying to do arithmetic operations based on the operators passed as method parameter. I can perform this in many ways but problem is I've a datatable to be operated upon. I cannot pass particular ...
StackUseR's user avatar
  • 958
-1 votes
1 answer
45 views

What does the ? operator do in C#? [duplicate]

I'm looking through this piece of code: https://github.com/aras-p/UnityGaussianSplatting/blob/main/package/Runtime/GaussianSplatRenderer.cs and line 65 has, m_CommandBuffer?.Dispose(); Which I don't ...
Ethan's user avatar
  • 167
0 votes
1 answer
89 views

Convert string to C# Conditional operator [closed]

I'd like convert string to ConditionalOperator, few sample : "and" to && "or" to || "greatherthan" to >= "contains" to .Contains Something like ...
TheBoubou's user avatar
  • 19.8k
0 votes
4 answers
121 views

In C#, why does the 'is' operator behave like this in the following situations? [duplicate]

I have the following code in a .Net6 console application. internal class Program { static void Main(string[] args) { var x = new SomethingUser<Something>(); ...
AKJ's user avatar
  • 11
0 votes
0 answers
67 views

WPF Calculator with more than One Operator at a Time not working

The Code is still unfinished but the Main problem I keep getting stuck on are the Operators. I have one Method for all my Operators but I can only use on Operator at a Time. Whenever the second ...
Laszlo Adams's user avatar
0 votes
1 answer
19 views

Directly Derive Delegate for Double Division

The double numerical type has a division operator. I can divide one double by another by simply writing x / y where x and y are both doubles. My understanding is that, in the computer, this operation ...
Brendan Lynn's user avatar
1 vote
1 answer
29 views

Class with custom Constraint

How can I do this? Limit to use defined operation Data Types(T) or limit to use an T whit Defined for all addition, multiplication and subtraction operations here is my Matrix class class Matrix<T&...
Mahdi Jafari's user avatar
-1 votes
1 answer
46 views

How can I cast a class to an interface with a matching method signature in C#?

Let's say we have an interface IFoo that defines a single method with the signature: public void Bar(). We also have a class Baz that defines multiple methods, one of which has the same exact ...
Vaughn Hartling's user avatar
-1 votes
1 answer
84 views

how 1 +"2" works in C#

I was reading about the type safety in C# like how we can't assign an integer value to a bool etc., which made me to do some experiment. I executed a code snippet hoping that it will give a compile ...
Aman singh Parihar's user avatar
1 vote
2 answers
315 views

.Net 7 - Null Conditional-Access Operator (?. or ?[]) Rules in Boolean Evaluations

I was wondering if someone has a documentation source or a good explanation for the exact rules/implementation of the interactions between a boolean-resulting operation and the null conditional-access ...
littleAndroidMan's user avatar
1 vote
1 answer
70 views

Compare and Calculate with numeric generic Type T

I have the following C# code: T convert(T numericInput) { int threshold = 2; double factor = 0.5; if(numericInput > threshold) { numericInput *= factor; } return numericInput; } ...
Brudi_Voeller's user avatar
1 vote
5 answers
242 views

In C#, How can I create or overload an assignment operator to possibly assign two values at once?

This is probably a stupid question, but just in case.... We have a 3rd party package with weird models like: public partial class CountingDevice { public int countingDeviceNo { get; set; } ...
Brian Kessler's user avatar
4 votes
2 answers
202 views

c++ 20 concepts alternative in c#

In c++ 20 we can use concepts which works like the where keyword in c# but I'm wondering how can i check T has some operator overloaded on it. c++ Example:- template <class T> concept ...
zain ul din's user avatar

15 30 50 per page
1
2 3 4 5
44