C#

C

C#

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

Join

✅ difference between internal and file access modifiers

the content on Microsoft Learn is a bit difficult to understand.

Blazor - Can we OnValidSubmit for every control change?

Hi, I am looking to develop and application using Blazor. I have a standard form with a model. OnValidSubmit is currently being fired by a submit button. However, I am looking to submit the form on every change of any control on the form. Googling for an hour has not lead me to an answer. Does anyone have any pointers?...

Can't override OpenApiSchema

Hello devs, Someone can tell me what is wrong in this code: ``` .WithOpenApi(...

Just learned generics...

I just learned generics and have a problem that i tried googling but still couldnt solve. I have a person class ```C#...

✅ Migration-independent Database Seeding

Curious if EF has some sort of independent database seeding potential? I am kinda hoping to see a similar functionality to Laravel's Database Seeder where you can write the seed in a file which you can run at any time, regardless of whether or not your migrations are already ran. I find the HasData fucntiuonality inherently counterproductive as I don't want to re-run all migrations over and over just so I can work with my seed data. Laravel Seeding: https://laravel.com/docs/11.x/seeding...

Simple yolo webcam throwing System.InvalidOperationException: 'The calling thread cannot access this

any help is SUPER appreciated. This is in WPF and the error is at the end of my WebcamAsync task

Save an image to a mysql

cmd = new MySqlCommand(query, con); cmd.Parameters.AddWithValue("@image", client.Image); I tried this method, but saved "System.Image.bitmap" on the database How can I save the image to the mysql database?...

WinRTC

Hello, Is anyone still using WinRTC for their Windows desktop application? Is the library still active in the development? Are there any alternatives for this Library? I couldn't find much information about WinRTC online, so I wanted to know from this community!...

DataSet, DataTable from System library doesn't generate nullable attribute.

In System. Data. Common has a DataSet, when you call api Dataset.GenerateXmlSchema(), it generates XSD file with elements and type attributes, but it doesn't add "nilable" attribute to the xml elements. Is there other ways to generate xsd file from postgreSQL Database with appropriate attributes?

✅ my application in the assembly works fine on my PC, BUT

my application in the assembly works fine on my PC, but opens for a few seconds and closes if I try to run the exe file on another PC and no it's not because I forgot to set the action wait in the program I created a simple program and hello world with reading the line and it also immediately closes...

✅ Test keep returning 503 while postman give 200

I really have no clue why http in the test give me 503
No description

Creating a class Player based on instructions

Hi i got a few questions. What exactly does an enum do and how would it apply to my program?` ```cs public abstract class Player {...
No description

books or tutorials which talk bout: action invoker,model binder,under the hood in asp.net core

i wish if i find books or tutorials that talk about how action invoker method ,model binder ,code under the hood

✅ WPF Application, renaming

So i'm currently going through an assignment and creating the necessary classes which our WPF program should have. However i got a question... It says i should rename the initial MainWindow to GameWindow. Does that mean i rename MainWindow.xaml.cs to GameWindow.xaml.cs ? The problem is if i do that i get an error.....
No description

✅ Help interpreting classes

GameWindow, do you think they mean that i should rename the program.cs into GameWindow. Or what do they meanwith MainWindow? Maybe it shouldn't be a Console Application?
No description

Basic stuff: c#

so i am new to programming i only learnt the basics, so please don't laugh at this, but i don't quite understand using classes in other classes(not program.cs i mean other classes). for example: internal class WritingTool { private string name;...

✅ Unit Testing in Rider not working

Hello, I've unsuccessfully attempted to use NUnit 3.14 with Net 8.0, and Xunit 2.5.3 with Net 8.0, and Xunit (2.0 or 2.1.0.3179) with Net 4.0, and NUnit 3.5 with Net 4.0 - all respectively shown in this video: https://www.youtube.com/watch?v=PyY5X7ylGOc I've also tried both with Net 7.0 According to NUnit, Net 4.0 should be compatible with any NUnit underneath 4.3; I'm surprised NUnit 3.5 didn't work with Net 4.0: https://docs.nunit.org/articles/vs-test-adapter/Supported-Frameworks.html...