C#

C

C#

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

Join

Help!!!

Hey, I'm looking for someone who can briefly structure my code into different classes for me. I am still relatively new to CSharp and currently only get errors. Would be nice if someone would contact me via DM. 🙂

Reflection Load Interface Instance

so i am loading plugins from multiple assemblies and i look for types Implementing the IPlugin interface. I then create an instance of that class (i tried both using activator and manual constuctor call) and when a look at the GetType from the instance i get back, i see the IPlugin and IDisposalbe interfaces listed as implemented on the Type Info, but when i try to cast/use the interface methods i simply get an exception or null (System.InvalidCastException: Unable to cast object of type 'TestPl...

I require some help understanding MVC and Database loading/updating

Hi, I'm very new to MVC and new to ASP.NET CORE, So these questions may be all over the place. I do have an understanding of C# & Object-Oriented programming. I'm trying to make a web application that has two tables, a Users table and a UserPhoneNumbers table, for this app I am allowing a single User to have Multiple UserPhoneNumber attached to it. I understand that I'll need a Model for each. Here are my two example models...

✅ static r public?

I was writing code something like this, class Physics { public int Force; }...
No description

How to get documents for specific user by Cloud Firestore?

I am developing a .NET MAUI application where users can register and sign in. After logging in, they can perform CRUD operations on documents. Each document saved to Cloud Firestore includes a user_id or owner_id property to indicate the owner. What is the best way to filter documents so that I only retrieve those associated with a specific user? Currently, I am using: CollectionReference documentsRef = db.Collection("documents"); and then querying for documents where UserId equals the currentUserId....

✅ How do I get to the graphical window (where I can drag and drop tools)

I'm studying some graphics now with WPF. I've added a button and label, but after I was running the program, the graphical window disappeared , how do I get it back? Thank you!...
No description

✅ new

I've seen people write code like this and I was wondering what it does and what it is called. An example is, apple apple = new apple(); if you know what this is, please help me....

Token Claims Membership Mapping

Aside from using Microsoft Graph (which - in theory - shouldn't be required for the application), does anyone know how to map these group guids I'm getting back on the claim to an actual group? They don't exist anywhere in my forest according Microsoft Entra - but it's, clearly, being returned in the groups section[s] of the claim.
No description

✅ I'm trying to work with Timer class but something doesn't work properly..

I'm following "Bob Tabor" course in Microsoft channel. I'm following him step by step, but it seems like what works for him doesn't work anymore, maybe C# update took a part in the past? It doesn't detect the Timer object in line 11 for some reason, what is wrong? Bob Tabor did it exactly this way. ...
No description

✅ Methods

I'm new to C# and I was wondering what is a method? Is it like a reusable chunk of code and what can it be applied to?

Avalonia UI what I need to learn?

Hi I want to create desktop app using Avalonia I'm having experience with WinForms. I need to create application which fetch categories (simple list of Category objects class contains prop Name and IsSelected) using api and render list of categories, categories are dynamically shown (not hardcoded list). Add button which will run operation to process selected categories. Also I need to show loading indicator when I'm waiting to fetch data, when data are presented hide loader indicator....

WPF Resource Issue

Hello all. I am having a weird issue or I'm overlooking something in WPF. This is my code: App.xaml...
No description

Issues Updating Hybrid .NET MAUI Project from .NET 7 to .NET 8 with Xcode 16 and macOS Updates

I'm facing serious issues after updating my hybrid .NET MAUI project from .NET 7 to .NET 8. This project was started in 2021, and everything worked well under .NET 7. Recently, I updated the following: .NET: Upgraded from .NET 7 to .NET 8. macOS: Upgraded to the latest macOS version. Xcode: Updated to Xcode 16....

invalid column SQL

```sql select inv_mast.item_id, sum(qty_on_hand) qty_on_hand, max(invoice_date) latest_invoice_date from inv_mast join inv_loc on inv_loc.inv_mast_uid = inv_mast.inv_mast_uid full join p21_sales_history_report_view on inv_mast.inv_mast_uid = p21_sales_history_report_view.inv_mast_uid where qty_on_hand > 0 and location_id <> 40 and latest_invoice_date <= DATEADD(YEAR,-2,getdate())...

Issue saving file in packaged WinUI3 app (No issue on UWP)

Hi everyone, I am facing an issue in which when I make a Release build of my app, the local storage seems to not work... On Debug builds it works perfectly. On UWP it works regardless if it is on a Release build or Debug build. Really confusing! Additionally, I share the code between my UWP project and WinUI project....

Does this count as an InsertionSort

So i need to program an Insertionsort for my school and i just wanted to ask if this would count as one. I does sort the numbers atleast.
No description

✅ Pink material

I have this code, but the material dont work he is pink maybe u now there my problem? Shader "Graph/Point Surface" { Properties { ...
No description

What does this mean

i know its just a ide recommendation but what does it mean
No description

✅ Desktop app not opening

Hi, i was working on my app, nothing wrong and all of a sudden it has an error, its okay i just deleted a function that was in the Form Designer "auto-generated" code region, so ir emoved that and it usually works but it crashed and i can't open my project anymore, i can still open the files individually tho on the file explorer
No description