C#

C

C#

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

Join

✅ Azure key vault with microservices

Hello, Right now I have 2 microservice, they communicate with RabbitMq, so the credentials are the same. Would it be more reasonable to have 2 key vaults storing the same secrets, one vault per each microservice, or create an extra vault for shared secrets? 2 vault, 1 per each microservice or 3 vault, 1 per each microservice + a shared one?...

✅ A problem with field.

I have an abstract Entity class. This class has "Position" field. I also have a Player class, that inherits from Entity. Position in Player sets to an certain value (let's say 1, 1) every frame. But for some reason, if I'll try to access entity's position it'll only return the position that set through the constructor, no matter what I do. (it's 0, 0) figuratively speaking, how can I make it return 1, 1?...
No description

Main Menu load

So i have a Main Menu that i want to load when i start the game in unity. One idea of me was to have it shown at the beginning and then to turn it off via script. But when i want to restart the Level i get it again because i just reload the Scene from the beginning but if i put in the line to make the Main menu invisible it does not work and stays visible.
No description

✅ How to access specific fields from an [ObservableProperty] ObservableCollection<Object>?

Hoping to pick someone's brain on MVVM and MAUI. So I have a ViewModel that looks like: ```cs public partial class TermsViewModel : ObservableObject { public TermsViewModel()...

✅ how do i override built-in methods?

i come from python where you can override methods in a class to work a certain way. for example, for use in the == operator, you can override a class to modify the behaviour of the __eq__ method which checks if two objects are equal. if i wanted to do an XOR on a class that holds an internal value, how can i override it so it works on the internal value instead of the class itself?...

✅ Find .NET course on Udemy

Hello everybody I'm a 2nd year student. I'm studying C#, I want to learn Backend Web and use .Net. Can you recommend me some Udemy .Net courses? When I went to look, there were too many keys so I was confused :)))))))...

Issues with SKImageFilter

I've been trying to get SKImageFilter to apply a blur to an image in the way I want it to, but have been consistently having issues. I have tried both the latest release and latest preview of SkiaSharp, but SKShaderTileMode.Repeat (and all other SKShaderTileModes) do absolutely nothing compared to removing the option entirely, and I need SKShaderTileMode.Repeat Code snippet:...

✅ SQL Database Assignment - Simple question

So i have a school project where we are meant to create a Restaurant table booking system. So i've set one up completely and was thinking i'd create a sister restaurant to the primary one. I've never implemented multiple SQL databases in the same project. How would you go about that? Should i create multiple Controllers? One for each Restaurant?...

C# quizzes

Hello everyone, to practice C#, i want to test myself and do some quizzes, but unfortunately for some reason C# doesnt have many resources. Does anyone know any site or ANYTHING where they give good challenging quizzes? Not necessarily where you have to CODE the answer, theoretical is more preferred. However, any resource would be appreciated. I searched for famous sites like geeksforgeeks, hackerrank, but they dont have quizzes for c#, but have them for java,c , c++, python, etc. Thank you beforehand...

Can't Figure Out How to Generate MSIX on Publishing MAUI App

I am trying to publish my app to the Microsoft Store, and I can't seem to generate the required MSIX package. I am including the .csproj and app manifest files and applicable screenshots with this post. When I click Create, the screen indicates that a package has successfully been created and placed in my /Package folder, but this folder is never generated, and I cannot find any .MSIX files anywhere in the solutions folder....
No description

Docker build cache

Is it normall that my docker build cache is 8gb? I literally have like 1 image/container that I delete and re-install. My RPI has only 16 gb memory and it doesn't feel right that I have to clean build cache everytime....

✅ ternary select between static classes

i have two static classes like this ```cs public static class WhitePieces { ... }...

Project ideas

Tell me some project ideas that will make you learn and have some fun. It may be a 10 minute project or something that will take weeks. I would like some Windows Forms projects.

DataGridViewCell won't display line breaks properly when editing

I'm trying to put multiple lines in this DataGridViewCell, but when I edit the value, the line breaks disappear, seemingly because they get converted into \n when the cell's value is set rather than staying as \r\n. How can I fix this? This is .NET 4.7.2 WinForms. If I could use WPF and/or a more modern .NET version, I would.

Passing one int from one script to another

So this isa stupid Question but im using unity for a game and i want to pass one int from a script that counts how many items were collected and i want to use it in another Script as a score. I tried a lot but nothing works. I tried FindObjectOfType and it gives me an error
No description

ImageSharp Alpha overwrite

I want to fill an ellipse on a destination image with ImageSharp. My filling color has 25% transparency and all alpha and pixel blending modes don't seem to support just overwriting the alpha value in the destination image. It always blends them in some way (like multiplication, add, etc) Is there possibly a built-in extensions or similar that allows this overwrite. It seems so basic, and the only option I currently see is writing my own pixel processor....

confused on this error

I'm having trouble understanding what this error is trying to tell me
void square_manager+<ListInvoices>d__5.MoveNext(): System.NullReferenceException: Object reference not set to an instance of an object.
void square_manager+<ListInvoices>d__5.MoveNext(): System.NullReferenceException: Object reference not set to an instance of an object.
manager_invoices.cs...

Handling exceptions when querying with EF

Looking for a little insight... so I'm just working through how to properly use EntityFramework, and I'm handling a simple login from a list of users from a database (yes I know the password should be hashed and salted, but i was going to handle that after. Just want it to work for now) My Users database has Id which is a BINARY(16) for a smaller method of storing GUID, and it has a virtual column it can reference for IdText which is the full version of the GUID in a string format. I'm passing the GUID string back to my application to use for future queries on courses or semesters in school bound to your user. My login is...

Why does Task 1 prints first instead of Task 3 - Async & Await

```cs internal class Program { private static async Task Main(string[] args)...