r/csharp • • 13h ago

Blog MVVM in C#: What Changes When You Switch UI Frameworks?

Thumbnail
qt.io
49 Upvotes

Hello, Miguel from Qt (qt.io) here. Following the release of the Qt Bridge for C#, I'd now like to share with you our latest blog post addressing some of the questions that we've since been asked.

"If I change UI frameworks, will the C# MVVM backend of my application still work?" This is the most frequent question that we've received from developers since releasing the Qt Bridge for C#. We wanted to provide some detailed information to back the answer to that question, which is: yes, when moving to a Qt Quick / QML UI, your C# MVVM backend will still work in the exact same way.


r/csharp • • 16h ago

Help Help with console game (beginner)

Post image
10 Upvotes

I have to make a console game on C# for my class and i thougt about making a hacking mini game like in Cyberpunk 2077, my question is how realistiv this would be since im really not that good at coding yet.

the Goal is to get all 3 hacks by picking a row and then of that pick another pick in the column and then the row of that pick again.

i hope this is somewhat understandable.


r/csharp • • 9h ago

I've been building my own modular Discord bot framework in C# -- OpenBot

Thumbnail
github.com
2 Upvotes

I've been working on a framework to make Discord bots fully modular, with a full framework. It works with "modules" which are part of the core bot itself and are required, and "extensions" which can be drag and dropped in to the bot's directory to add functionality.

I made (it's still in early development) this to solve a problem which I think everyone has experienced - they need a butt load of bots in their Discord server for all their different requirements.

It's open source, and I'm at the point where I'm starting to try to get it out there and would genuinely appreciate other .NET developers checking it out. Thanks.


r/csharp • • 2h ago

Showcase AppTunnel — a WinForms/.NET 10 app that puts only chosen Windows apps through a Proton VPN WireGuard tunnel (MIT)

1 Upvotes

I built AppTunnel because I wanted per-app routing for Proton VPN on Windows (Discord and a couple of other apps) without sending the whole PC through the tunnel.

It's a WinForms app on .NET 10 split into three projects: the UI, a core library that validates WireGuard profiles and builds the session config, and a small process that hosts the Proton login page in WebView2. The WireSock Secure Connect CLI does the actual packet routing.

A few implementation details I'd love feedback on:

  • Profiles are encrypted with DPAPI. The session config is written to ProgramData with a restricted ACL and removed on disconnect.
  • Server switching replaces the Windows service and rolls back to the previous session if the new one doesn't complete a handshake.
  • The WireGuard profile validator accepts one [Interface] and a single [Peer] and rejects anything else.

Repo (MIT): https://github.com/F404X/app-tunnel

[AI] Part of the code was written with AI assistance. I reviewed and tested it.

Not affiliated with Proton or WireSock. Windows 10/11 x64 only.


r/csharp • • 7h ago

Help Automatically cast a parent property to the child class given in the constructor

0 Upvotes

in this situation, in the class CatPerson, i would have to manually do ((Cat)pet).catProperty in each method i'd want to use it
i wonder if it's possible to avoid having to manually cast it, is there a way to say something like: in this class, the parent property "pet" must be considered as being of class "Cat" instead of just "Animal"

public class Animal
{
    //stuff
}

public class Cat: Animal
{
    public string catProperty;
}

public class Person
{
    public Animal pet;
    public Person(Animal pet) {
        this.pet = pet;
    }
}

public class CatPerson : Person
{
    public CatPerson(Cat pet) : base(pet) //=> give type Cat in constructor
    { 

    }

    public void doStuff()
    {
        // pet.catProperty  => pet is not seen as a type "Cat" without casting
    }
}