We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.

Join Server

Community questions


❔ why new is needed for reference types

Can someone explain why the new operator is used for references types but not value types.

When I assign an variable x of type int to 10 is 10 just binary in the computer or an object of the int class.

And what does it mean for to store references to your data and how is that the same as an object

❔ Web stack and connecting C# backend w/ Next.js frontend

Hey! Recently been learning frontend with React and Next.js, so far so good, however, for my project which is somewhat complex, I think I need a separate backend than the options that Next.js itself provides. Backend REST API and realtime SignalR handles data streamline for the applicaiton. Sounds good on paper, however I'm not entirely sure that it is that simple and more than that I lack understanding how the entire thing will be working, connecting and hosting.

For me as for someone new int...

✅ Installing the .NET SDK on Ubuntu 23.04

Does anyone here have experience with installing .NET 7 on Ubuntu?

❔ Get Informations of Form 1 in Form 2

Hello, I want to copie the Labeltext in Form 1 with the name "LinieValue" to Form2 inLabel4.
How can i do this?

uint value comparison for a 32 layer system (GameDev)

Hello. I'm looking for a way to see if these toggles are on or off by comparing the total value of the uint.

How it works is that if the toggle is on, it returns the corresponding uint value and if it is off it returns zero. If we take top row for example, it goes from and index of 31 backwards to an index of 1. All these values that the toggles represents get added on top of each other and that results in the actual uint value. Taking the toggles on the top row as an example a...

Retrieving message from a UDP socket

Heyo I'm following some guide thats using js, I need to find the C# equivalent

❔ Create a custom register/login razor views for my Blazor identity.

I have Blazor app connected to my db and it works as an identity for both register,login etc, but I want to customise it, I dont want to register with just email and passowrd, I want to add other fields, how to do that? any reference links /tutorials would be great!

❔ LLVM problem with creating number

public (Context, LLVMValueRef) VisitNumber(Context ctx, NumberAST expr)
LLVMTypeRef typeRef = LLVMTypeRef.Double;
if (expr.Type == typeof(long)) typeRef = LLVMTypeRef.Int64;
else if (expr.Type == typeof(int)) typeRef = LLVMTypeRef.Int32;
else if (expr.Type == typeof(short)) typeRef = LLVMTypeRef.Int16;
else if (expr.Type == typeof(sbyte)) typeRef = LLVMTypeRef.Int8;

else if (expr.Type == typeof(ulong)) typeRef = LLVMTypeRef.Int64;
else if (expr.Type == typeof...

❔ i learnt c#what's next.

I want build something

✅ I was programming with java

I was programming with java and this error happened :( how do i fix??

❔ Error in iOS MAUI app when trying to use WebAuthenticator

Hello! I'm trying to write a simple mobile app that hits my own API. I wrote a wrapper for the API that triggers a new authentication with WebAuthenticator.AuthenticateAsync if there's no valid authentication session. This works if I trigger a new auth session from a button, but trying to do an API request when a view loads (from OnAppearing) gives me this on iOS:
Foundation.NSErrorException: Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=3 "The UIWindowScene for...

❔ wwwroot only working in IIS express, not http

i have a simple razor pages web app, but wwwroot will not work whatsoever if i choose http, but if i choose iis express, it works just fine. Why is this happening? I don't know what code or logs i shouuld also show

✅ Cant access base parameter in children partial class

I have a partial class that herits from a parent class. In the children class, i cant access any of the parent properties, but it works if the class is not partial. Is it normal or is it a bug? Pictures in comments

Inventory Maintence Project Issue

I have two forms, one that lets you enter data for a new item. Once you hit Save, it should create a new InvItem object and add it to a list of inventory items and display it in the list. I can't seem to figure out how to get it to add the item. Any suggestions?

❔ Factory Design method pattern

Hello! Can some one help me with Factory Method, I am working on RPN Calculator project and need to use this design method but I don't understand how it works and how to implement it. ChatGPT gave me a solution but i want to learn how it works.
public interface IOperator
public double Calc(double x, double y);

public class Add : IOperator
public double Calc(double x, double y) => x+ y;


//not sure how to do it
public class Div : IOperator

public double Calc...

❔ Is there a way to make this more cleaner?

<div class="buttons">
<div class="dropdown">
<a button type="button" class="btn btn-success">
Add a new habit
<a button type="button" class="btn btn-success">
Log a habit
@<div class="dropdown">@
<button class="btn btn-success dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="tru...

Is there a way to determine if a Winforms .exe is run by double clicking on it on Windows explorer?

What I wish to achieve is nothing too fancy. I just want to determine if my winforms exe is run from within windows, or through another .exe. A bool like isLaunchedFromWinExplorer or isLaunchedFromAnotherApplication would suffice. I will show Form1 if the former, show Form2 if the latter. Thanks!

❔ Recommended way to follow developments in C# / .NET world?

I'm looking for a way to follow weekly or monthly developments in the C# / .NET world, something comparable to https://this-week-in-rust.org/. Does it exist?

✅ dotnet add reference in vscode

there is gui way to add reference in vscode instead of run command or type , i mean like vs community does, just r click and choice add referenceee ?

❔ win form app desinger app erorr

Severity Code Description Project File Line Suppression State
Error CS1061 'Form1' does not contain a definition for 'Form1_load' and no accessible extension method 'Form1_load' accepting a first argument of type 'Form1' could be found (are you missing a using directive or an assembly reference?) ödev C:\Users\cengiz\source\reposödevödev\Form1.Designer.cs 147 Active
this error