C#

C

C#

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

Join Server

Community questions

FFigure9/20/2023

❔ 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
M.mylaff9/20/2023

❔ 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...
Wwgrs9/20/2023

✅ Installing the .NET SDK on Ubuntu 23.04

Does anyone here have experience with installing .NET 7 on Ubuntu?
Nnichtfamedominik9/20/2023

❔ 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?
Yyjplapi9/20/2023

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.

Description
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...
Aarchyinuse9/20/2023

Retrieving message from a UDP socket

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

❔ 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!
Ttruetheos9/20/2023

❔ LLVM problem with creating number

```cs
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...
Sslamz_7599/20/2023

❔ i learnt c#what's next.

I want build something
Nnualiini9/20/2023

✅ I was programming with java

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

❔ 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...
Zzai_tm9/20/2023

❔ wwwroot only working in IIS express, not http

hello,
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
Ssimchor9/19/2023

✅ 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
Rrotting_souls9/19/2023

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?
GGeorge.saba9/19/2023

❔ 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.
```cs
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...
_._._9/19/2023

❔ Is there a way to make this more cleaner?

```html
<div class="buttons">
<div class="dropdown">
<a button type="button" class="btn btn-success">
<svg>
<path></path>
</svg>
Add a new habit
</a>
<a button type="button" class="btn btn-success">
<svg>
<path></path>
</svg>
Log a habit
</a>
@<div class="dropdown">@
<button class="btn btn-success dropdown-toggle" type="button" id="dropdownMenuButton" data-bs-toggle="dropdown" aria-haspopup="tru...
Vverpinzal9/19/2023

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!
Aaochagavia9/19/2023

❔ 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?
Ooutrageous_kitten_233499/19/2023

✅ 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 ?
Kkayjs9/19/2023

❔ 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