C#

C

C#

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

Join Server
DDewo4/12/2024

Linq with multipe joinGroup()

I'm trying to retrieve all the 'ExerciseCompletion' that have status 'Succeeded' starting from the 'Lesson' table. I therefore did a groupJoin() to get the exercises of each lesson and then flattened out the lists with a selectMany() (with a DefaultIfEmpty() to keep all lessons that doesn't contain any exercise). The problem I encounter is that a I can't really make my second groupJoin() to join the 'ExerciseCompletion' database since the 'Exercise.Id' may be null (because of the DefaultIfEmpty()) and will therefore discard rows with null 'Exercise.Id' (which I need to keep) Do you know how I could make my second join by keeping all my entries in my left table ? Here is my current code :...
No description
KKrille4/12/2024

Need some help debugging EF Core db query

I am trying to get some information from the database. I am running this query: ```CS var ordersInLastThirtyDays = await _dbContext.Orders .AsSplitQuery() .IgnorePending()...
No description
Rrestingphantom4/12/2024

Seed cannot be added because of required property ID

The seed entity for entity type 'Series' cannot be added because no value was provided for the required property 'Id'.
No description
OOliverVincent4/12/2024

Razor Page Validation Error Message

For "int" and "decimal" it gives a standard error message instead of my pre defined. "Is not valid for x" How do I change this?
No description
EEple4/12/2024

Help Needed: Choosing Between VSCode on Mac or Visual Studio via Remote Desktop for Windows Backgrou

I'm starting a new project and can't decide between two options: using VSCode on my Mac or using Visual Studio on a Windows computer through remote desktop (the connection is fast and stable). The project is a background service that will eventually run on Windows. Any suggestions on which setup would be better for this?
EElio4/12/2024

"Animate" an image along a axis

Hi, i'm using wpf and i want to code the "animation" of an Image. I want to move the image on an axis from 0 to 100 depends of int X. Should i use Canvas to set the position of the image depends of the X parameter ?...
No description
BBlyZe4/12/2024

2D array doesn't initialize the correct size (Checked with breakpoints)

In the ConsoleGraphic ctor I initialize a new 2D Glyph array. When the _console.Buffer.Width is 960 and _console.Buffer.Height is 360 the array gets initialized as 256, 144. Why could this happen? ```cs internal ConsoleGraphic(CmdConsole console, ConsoleGameSettings settings)...
Wwtq40cy3n4/12/2024

How to understand pining static field, const and instance field

I am learning unsafe C#, and trying to understand when to use fixed statement. Here's the example: ```cs class K { public int k; } struct C {...
MCMary Cooper4/12/2024

beginner help

No description
Ccjhowe4/12/2024

Is it possible to use `Span` with a type erased `System.Array` created with `Array.CreateInstance`?

I am working on a C# ECS which stores its components in an archetype which contains an array of arrays. The outer arrays represent the various component types of the ECS (velocity, position), and the inner arrays represent all of the components of that type in the archetype (position 1 with x = 1, position 2 with y = 5). I want to be able to move components between arrays while avoiding copying in cases where it's unnecessary, even when the type is a value type. Ideally, I would be able to get r...
Pplushechka4/11/2024

xamarin support

Is it known that xamarin will be supported for at least another six months without transferring it to MAUI?
SScrubsCJourney4/11/2024

✅ The minimum…

I’m sure this has been asked before. Been in IT for 20+ years, took a burnout break a couple years ago. Decided on a career change possibly. Over the yeses I’ve learned html,css and a teeny bit of js. But really nothing of note to produce anything. But enough to say I should plow through and not give up now. A friend who has started getting his business actually going wants me to keep going as he knows there’s a spark of potential. ...
Cconny4/11/2024

How to read this type of documentation?

Hi! Once again in my life I have come across such documentation. How to decode it? Do you have any tutorials or advice on how to go about it? I've usually managed to get examples etc., but this time I have to get on with it myself from scratch. I usually work with APIs where the methods and fields are manually described, here everything is probably generated automatically and I can't find my way around it
No description
ZZlatan4/11/2024

help im a beginner in wpf and i have urgent deadline

so i have like a homework and exam next week, but for now i just ask for 1 thing, how to make a calculator, like i know how to pu the buttons, textbox and etc, but idk how to code and make it works, like where should i code, and how, idk the page or which file i should code or make the program, the teacher is so sudden by giving us this kind of homework and exam. can somebody help me? like what or how to code and make a calculator in wpf
AApache4/11/2024

Migrating WSDL imports via ServiceDescriptionImporter from Framework to Core

I'm writing documentation website for a backwards compatible API. I'm migrating code from .NET Framework 4.7.2, to .NET8. In net472, we get the results of any given WSDL URL, read it into a System.Web.Services.Description.ServiceDescription, check if there are any warnings with a System.Web.Services.Description.ServiceDescriptionImporter, create an assembly in memory, with Microsoft.CSharp.CSharpCodeProvider, and then read the System.Type from the assembly via reflection. A lot of this has been ripped out of BCL in Core. Both SOAP and WCF are both depreciated, but a lot of our clients still use the SOAP services on legacy projects; so we need to keep them up, and documented. But, we also need to move on tech-stack wise. So, I'm wondering what the options are. Ideally, some wonderful person will have created a NuGet library that would wrap all of this up, and make it all magically work within net8.0. But, failing the coming of a saviour, how else would it be possible to programmatically resolve a System.Type from any given WSDL URL?...
未来4/11/2024

✅ How do i learn C#, as a Junior Frontend Developer who have used JavaScript and React, TailwindCSS

Hello internet strangers, I want to learn C#, Where is the best place for me to learn it, as a Junior Frontend Developer who have used JavaScript and React, TailwindCSS? I have already built webapps with React, and NEXT.js etc. So i wouldnt say am a noob noob, but wont give myself the title of a Pro...
Kkurumi4/11/2024

XmlReader generic Mapper

Hello 👋 . I am trying to create generic mapper for my project, that is using XmlReader. All my XML files have same structure, i.e.: ```xml <ROOT> <OBJECT ID="52022696" OBJECTID="1456218" NAME="Abaya" TYPENAME="street" ISACTUAL="1" ISACTIVE="0"/>...
HHäng4/11/2024

Disable Blazor NavLink

Is there any way to disable a NavLink in Blazor? While my application is doing some long calculations I want to prevent the user to navigate to another page....
Nnot1us1gamer4/11/2024

Asp.net Login and Signup

I have form where user can login or sign up but I need help with form saving the credentials to database.
BblackSheep4/11/2024

✅ C# + raylib + freebsd

Hi All, I'm running FreeBSD 14 Release, dotnet 8.0 compiled from Ports and Raylib 5.0 downloaded from GitHub. When I run a simple sample helloworld I get this error msg:...
Next