C#

C

C#

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

Join

How to use embbeddings. Net

Hello, has .net some libraries to work with embbeddings? Whats the most integrated vector db?

✅ Microsoft C#

Can someone DM me with regaurding the certification for C#. I'm having multiple errors popping up. I'm curious if it's something I am doing or what not. I'm honoring the Honesty guide for actually implimenting the process of learning. Could someone take some time to review with me

why is convert.toint32 must be there? and not just console.readline (line 4)

Console.WriteLine("whats ur name"); string name = Console.ReadLine(); Console.WriteLine("age?"); int age = Convert.ToInt32(Console.ReadLine()); ...

Want to learn Unity

so im a student who is hoping to make a game with my friends, the problem is none of us know how to use unity or code in C#, the only experience we have is in html 😅 , so got a couple of questions 1.Where and how should we learn unity and C# 2.How should we aproach when starting development on the game 3.How should we market it (the game will be a 2D game where you have to protect a tower from enemies that attack from all directions)...

Application runs out of memory after compressing many images

Im working on a side project to create a archive and im stumped at this one problem, i didnt encounter this problem before and i need to ask it here, the main issue is in ImageGrabber but i would appreciate if you would spot other bugs https://github.com/wick3nd/SEP-packager/blob/main/src/SEP%20packager/ImageGrabber.cs...

Help needed to implement oAuth2 Authorization Code Flow on Desktop Target without Device Protocol

Could someone help me with my authentication service setup for oAuth2 Authorization Code flow with Pkce? I did it the best as far as my few beginner knowledge reaches, but I am stuck at the point where I would need to open the Browser with redirect 🤔 I can not use WebAuthenticationBrokerProvier as this one is not fully implemented in the Uno codebase for desktop target, so I would trying to do with Process.Start 🤔 or WebView2 they have support for since the 6.0 version. I collected a few samples but I am unsure in connection with TaskCompletionSource maybe (?) how I have to chain this all up together 😅...

Environment.SpecialFolder.LocalApplicationData Falsely Showing My File Exists?

Any .NET developers on MacOS able to help me with an odd issue I'm facing? I'm working on a cli application in which I want to use a config file to persist some user-defined data fields. When the program starts, I check if the config file already exists and if not, to create my app's directory and config file within the Environment.SpecialFolder.LocalApplicationData directory. When I run this on Windows, I get expected behavior and can find the directory/file in my AddData\Local directory if File.Exists comes back true. But when I run it on MacOS in debug, the check for the config file's existence is returning true when I can't find the directory nor file in Finder as well as the terminal. It's like it never mde neither the directory or the file inside it. I attached screenshots of the value of the filename to create, and what I see in my Finder. The if-statement ALWAYS returns true but only on MacOS. Finder is set to show hidden items. It never gets to create the config file because File.Esists keeps coming back true instead of false like I'd expect. I kind of expected this to work on both operating systems because of the special folder in .NET. Any help would be appreciated....
No description

App structure

Do modern web apps run on top of an API is this to make native versions of the same app easier as we just make some kind of frontend? If so do we just access the API the same way, via GET, POST etc requests?

Going through the microsoft training, do i NEED Visual Studio Code?

I have Visual Studio 2022 and I was told this would be perfect to learn with. including .NET, but the tutorials I've been going through had a whole section where you install it, and I did, but I just kind of like VS 2022 more if I'm being honest.

Virus found false positive

Hey there, so I recently created an avalonia C# application for my racing team. It just contains some UI aswell as some HTTP requests to my api hosted on a Server to get discord user data and so on. So really a „clean code“ without any trojan or virus. As soon as i want to publish it and open it on my 2nd pc, windows recognized it as a virus (trojan/… I dont know the exact anymore). I‘ve done some research and found out that I may need an EV cert. But to be honest, for an simple project, what I dont want to sell or publish that big, I dont want to spend 300$ on a cert. So here comes my question: Is there any way to remove that false positive? Also I‘ll publish the code on github so anyone can see. Are there stepa how I can debug whats triggering that false positive? Thank you very much!...

Self-contained, trimmed .NET 9 executable "can't find framework" when run

I'm attempting to publish a project with two NuGet dependencies (one with native libraries) as a single-file, trimmed executable. ```xml <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>net9.0</TargetFramework>...

✅ Hey everyone!

I'm a total beginner learning C# for my apprenticeship as an IT Assistant, and I'm currently working on a little notes app to practice. The problem is, whenever I try to add a new feature, it feels like I hit a wall and have to rewrite everything from scratch. My code isn't very modular, and it's frustrating trying to make changes without breaking the whole thing. I'd really appreciate it if some of you could take a look at my code and give me some advice. I'm trying to figure out how to structure my projects better and what concepts or design patterns I should learn next to make things more scalable....

Message Broker / Queue - Wolverine vs. EasyNetQ vs. MassTransit

I currently utilize RabbitMQ with EasyNetQ sitting on top of it ... been using it for years. Our C#/WPF enterprise app has around 200-300 concurrent users and I am in the process of rebuilding it from .NET 4.8 now in .NET 9.0. One thing I have noticed is that EasyNetQ does not seem to be receiving any updates and figured it might be a good time to revisit if that is the best fit. We primarily use RabbitMQ/EasyNetQ to handle "commands" from the client on the server (create/update/delete entities and to execute certain logic on demand)....

Blazor wasm help

Efficient list filtering Hi all , blazor wasm question, hoping someone might be able to help me. I have 2 tables , companies and employees . There's about 700 companies , 10,000 employees . I wanted to display all of the employees in a list while allowing filtering based on a few parameters. I also wanted to group the list by employer . ...

IEnumerable and loops

A bit of a rapid-fire question: if I only need to iterate on a collection once, is it OK to use IEnumerable? For example, using Directory.EnumerateFiles(path) to filter out the files in separate lists.

Daylight Saving and Time zones

Hi guys, I'm wondering what is the best way to store dates from different countries considering daylight saving and its volatility in the future to make a date filter for my app.

✅ The interface has static abstract members without implementations. How to fix?

I have this interface: ```cs public interface IEventProcessor { public static abstract IReadOnlyCollection<string> HandledEvents { get; }...

How to filter for a specific object in a nested list and get the resulting object with parent items

I have a list of nested objects that looks like this: ```cs class Item { List<Item> NestedItems;...

What Result Type For Endpoint That Does Validation

I have an api endpoint that validates a number. It calls a helper method ValidateTaxNumber(request) , and it that is true, the endpoint returns a 200:
return Ok(new ResponseVMInternal() { message = "Success", result = true, response_object = true, result_code = CoreErrorCode.SuccessC0 });
return Ok(new ResponseVMInternal() { message = "Success", result = true, response_object = true, result_code = CoreErrorCode.SuccessC0 });
The Ok function is ours, in our base controller and this set up result creation functions does not cater for all possible REST response?...

Execute code in API Controller from a razor page

I have API controllers that are work just fine I'm trying to execute similar code via another class Is something being sent to the API controler constructor? If so what and can I send the same thing in the razor file? Or am I going about this the wrong way? ...