C#

C

C#

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

Join

NetMQ: SendFrame never sends, never returns.

(I'm posting this here because I haven't found a ZeroMQ community. If you're aware of one, I'd appreciate a link.) (I have marked the question Beginner within the context of ZeroMQ; the problem really has little to do with C# or .Net.) I'm attempting to upgrade a .Net Framework 4.0 project to .Net Core. (The previous, working version of the project uses clrzmq.) So far I've managed to get it all working properly except the ZeroMQ aspect. ...

✅ Vue js + .Net Web Api

Hi, I am new to VueJS and web API. I have a new task to create a simple application.  fronted Vue.js  Backend is Web API.  this My Point To Complete ...

I’m looking for feedback on the security setup, which uses .NET MAUI, ASP.NET Core, and MongoDB.

Overview of the Architecture 1. API Authentication: To authenticate API calls from the MAUI client, I use an API key that is securely stored in Azure Key Vault and accessed by the API as needed. ...

Establishing binding between css and c# and sql

Hello, I made a login page with CSS, but I don't know how to connect it with C# and SQL. Can anyone help me with this?

Upload file with swagger ui crash

I'm trying to upload IFormFIle with swagger ui and as soon as I select file and click select or cancel the backend application crashes without any error displayed. Can I fix it? Is it better to switch to Postman? ``` [HttpPost("upload")] public async Task<IActionResult> Upload(IFormFile? formFile) {...
No description

✅ How come my containerized postgres+pgadmin won't let me connect to db from pgadmin?

Hi there, I've made a small docker compose file that should start up a simple db with pgadmin. But I am unable to connect from pgadmin, here's the file: ```yml version: '3.8' ...
No description

Choosing a model in ML.NET

I'm new to ML.NET (and ML in general) and I'm trying to learn a bit. My problem is the following: I have n iterations of a constant set of variables, and depending on the values of these variables I will get a score. The next iteration, n + 1, is dependent on the variables input in iteration n for it's score, and the variables of the current (n + 1) iteration. How would I choose an ML model to optimize the values of the variables each iteration in order to maximize the total score of all iterations?...

How to store user data blobs in MAUI iOS

What is the right way to get a safe path that binary, non user readable data can be stored? I tried using FileSystem.AppDataDirectory, but I noticed that it gets cleared on every test flight build.

✅ variable wont change

```cs switch(vars.AfterMath) { //vars is a class i got w all my variables in it //AfterMath is a variable that stores if you won or no...

Spawning objects at random X co-ordinates and in fixed intervals

Hi, I am making a game inside Monogame, using c#. I need my objects in the game to spawn in random X co-ordinates. I know how to spawn more than one in a specific state, but I cannot figure out how to spawn them randomly. I've tried a few methods; having a random number generator decide which block to spawn, setting the x and y co-ordinates to random number, which both returned error messages. I'm hoping I can get some help with this? Thanks! I'll attach some screenshots when I have them.

Running .jar file through c# on windows?

I wrote a program that downloads a jar file, then runs it. It works perfectly on linux but not on windows, does anyone know what the issue could be? (posting code in a sec)

DiscordPresence Issue

Severity Code Description Project File Line Suppression State
Error (active) CS0246 The type or namespace name 'DiscordPresence' could not be found (are you missing a using directive or an assembly reference?) Loader 12

private DiscordPresence discordPresence; // Declare the DiscordPresence instance
Severity Code Description Project File Line Suppression State
Error (active) CS0246 The type or namespace name 'DiscordPresence' could not be found (are you missing a using directive or an assembly reference?) Loader 12

private DiscordPresence discordPresence; // Declare the DiscordPresence instance
...
No description

WPF, window doesn't open with specified resolution

I have a button in my WPF project that opens a different window. Window should be 640x480 but when it opens by pressing the button it has the resolution of 800x600. I tried to set the resolution in the window xaml and code behind before opening the window. Window only has an image which resolution is also set to 640x480.
No description

Try-catch in an iterator

Is it possible to do a try-catch, or alternatively a try-finally over a yield return statement? When I try something like this: ```cs IEnumerator Method1(IDisposable disp) { try {...

✅ Error while exporting HTTPS dev certificate to a file.

Hi, has anyone encountered a similar problem? When I try to export the certificate to the project folder, I get an error (visible in the screenshot). Before formatting the system, I didn't have this issue. Does anyone have any idea what might be wrong?
No description

Is there a way to make a search bar for a datagrid in WPF?

Hi all, I'm using the entity framework for my database, I'm trying to make a search bar for one of the databases but I'm struggling on how to do it. Is there any advise or guides that can help me to make this, I had a look only but couldn't find anything related to my issue...unless I'm looking in the wrong place. I can send my code if needed.

Can I check-in virus/trojan to TFS/DevOPS

Hey guys, in devops we have some pipelines that create packages for our client. From yesterday I'm not able to download these packages cause I'm getting Virus Warning from defender. If I run computer scan with defender or malwarebytes it founds nothing but alse it seems that affected pipelines are the same I'm working with. Is there possibility there is some trojan or something comming from my computer ?
No description

Is there a better way to write this QueryBuilder?

Its my first time writing one and i want to make sure im doing it right ```cs public static class IQueryableExtensions {...

✅ !

what is the logical operator for "not" in C#?