C#

C

C#

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

Join

Kings can you help with cmy code please i'm struggling

I need to make the sorter in my project how do i do that?.
No description

Fractal help

Trying to create a fractal with graphics in .net framework for a project. I'm not sure how to mathematically generate the circles to create this twist, then loop it. Rough sketch to show what im going for
No description

.NET Runtime Docker build tools missing openssl

Hi, I am trying to build a modified .net runtime using docker and I get the following error: Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR) I cloned the repo locally and ran this : docker run --rm -v (my windows path here):/runtime -w /runtime mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net9.0-cross-amd64 ./build.sh --subset clr --configuration Checked. ...
No description

Blazor index page captures static files

I am trying to learn .NET Blazor. My aim is to create an question taking app where the correct questionare is rendered by either the root domain ("default questionare" depending on the domain used to access the service), id or slug. I have app.UseStaticFiles() in my pipeline before app.MapRzorComponents<App>() but the component is still triggered by static files. Program.cs...

✅ while loops

while loops keep repeating the same
Console.WriteLine("");
Console.WriteLine("");
over and over without waiting for the user to respond to the
String a = Console.ReadLine();
String a = Console.ReadLine();
anyone know how to solve this?...

Resources to learn dotnet framework

Ive been learning c# and now im somewhat comfortable in the language and i think its time for a simple project. Ive been trying to find a good tutorial for web applications development in c# but couldn’t find any and im a complete beginner so i have no idea how that stuff works.(i also prefer videos)

per pixel collision

Hi, I was just curious if anyone might know how to impliment per pixel collision into a project? I'm making a game for my A level Computer Science course - it's c# Monogame. The per pixel code is in each class that needs it, but how would I go about implimenting it in the game itself, and furthermore, should I put the code in a globals class instead? Thanks for any help in advance. I've attached screenshots of my code and where it needs to be used.
No description

Executing a jar file through c#

I'm trying to make a C# launcher for a java program so it'll be easier to run it, but I'm running into issues (especially with getting it working on linux specifically). Has anyone done this before?

✅ method glitch

it said I had an error saying "there is no static Main as and entry point" so I created one but didnt use it. I made a seperate method as my actual code but whenever I ran the code it wouldnt work it just says nothing and then "press any key to close"??

✅ randoms

does anyone know how to make random numbers but skip count so like 100, 200, 300?

Library not importing?

sorry very new to c# i tried to import a library called MouseKeyHook and it shows an error with the description: "The type or namespace name 'MouseKeyHook' could not be found (are you missing a using directive or an assembly reference?" i trying to import this way idk if is a syntax error or smh MainWindow.xaml.cs...

Data fetching in components?

I'm using Blazor Server. I have set up a partial class called DataContextComponent that uses DBContextFactory to create an instance of dbContext for the lifetime of that component. I thought this would be enough to keep components isolated, but I'm finding that if there is a parent and child component that both inherit from DataContextComponent and fetch data using EF Core, I get an error saying "a second operation was started on this context instance before a previous operation completed." Am I doing something wrong? I'd like to make reusable components that fetch their own data that I can use throughout the application. Is this an anti pattern?...

Dont know how to pass an image source into a style

I have a style for a radio button that uses an image for an icon of the radio button but i dont know how i would pass the image source into the style so that it would display the correct icon

Can't make MenuItem of same style as ContextMenu

https://paste.mod.gg/vvyjvtndoatj/0 - Here I have a code for a ContextMenu that expands into more subitems. However, the MenuItem box has an unchangeable style (Screenshot attached). I want to make everything have the same exact style.
No description

Issue with SQlite command

```cs List<(string IDClash, int IDDiscord)> joueursIDs = new List<(string, int)>(); using (SqliteConnection connection = new SqliteConnection(connectionString))...
No description

Error acquiring .NET!

I was opening vscode and got met with this error. Any idea what caused this? This (?) also prevents the lsp from working...

Cannot connect my application to sql server on docker.

I tried to dockerise my asp.net application, but I get an error while applying migrations if I try to run locally. When I try doing it I have API turned off and SQL server turned on. Docker-Compose ```version: '3.4' ...
No description

✅ Send automated email.

Hi everyone. I just finished a web scraper assignment that I got from school. I want to build on it and implement a system that lets me take the text that the web scraper generates and send it once a day as an email. What is the best way to do it?

ListBox entries from UserControl not working.

```csharp public static class Logger { public static string WriteLog(string message) {...