C#

C

C#

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

Join

What is wrong with my C# Perlin noise generator?

I've been trying to code my own implementation of the Perlin noise algorithm based on this paper: https://www.cs.umd.edu/class/spring2018/cmsc425/Lects/lect13-2d-perlin.pdf However, it ends up producing a weird pattern which is pretty far off the result I was looking for. The image it creates is below. I tried messing around with the noise function and dot product function, but I'm unsure of what is actually going wrong. I suspect that I've made a silly error with the logic behind it, so if one of you could point that out for me then that would be greatly appreciated....

chinese checkers Unity 2d

hallo i am new in this server and i want some help if anyone interested. my name is dani from sweden and i study game development in the university. we are working on a project to make a chinese checkers in unity and i find it hard to understand the MVC pattern we are working with. if anyone can help me understanding the cod better i have the project and all the scripts. pls send me a message.
No description

✅ How do Avro, ORC and Parquet work?

I have been learning about big data and these came across as a few of the popular "optimized file formats". I want to understand how they work.

Rectangle Collision Detection in Monogame

Hello, I am working on a game for my A level Computer Science course in Monogame. I am trying to work on rectangle collisions (I previously tried per-pixel but ultimately decided it wasn't worth the trouble). I need something to happen when two rectangles (one always being the player) collide, and given the types that collide, something different will happen. For enemies, there will be a check to see if the player is attacking, if they are, the enemy will die, and if not, the player will take da...
No description

Database adding letters to my output why?

public User GetUserByUsername(string username) { var usr = _context.Users.SingleOrDefault(x => x.Username == username); Debug.WriteLine(usr.PasswordHash); return usr; }...
No description

Diagonal Inputs not reading at all

I'm making a fighting game in Unity and I'm working on the input buffer for it. With this I can dynamically create new special moves and perform them Everything's working correctly so far except diagonals inputs don't read at all. I added a debug log to check whether it is actually being processed an no nothing's happening at all. Here's the script: https://pastecode.io/s/5q7mu5ax HandleInput() is working correctly but HandleDiagonalInput() isn't working at all...

ASP.NET WEB FORMS

I have a project to do in asp.ne web forms , right now its running on my local host but it needs to be a publicly accessible url so im unable to send emails to other devices unless they send me the url and then i ahve to open it on my pc
No description

Nuget packages

When I install a package from NuGet, I get this error: Package 'System.Text.Json' 8.0.4 has a high severity vulnerability
No description

Dynamically creating rows inside of document.createElement() isn't working with a template?

For some reason, I've managed to make a button that creates a new reply for the user and that works! But when I load from the database that same function for creating the button doesn't work? ```js function createReplyElement(replyText = '') { console.log("creating new reply with text: ", replyText); const template = document.getElementById('reply-template').content.cloneNode(true);...
No description

Micro-optimizing a Z80 emulators' pipeline. **Unsafe code**

so, i'm writing an emulator, and i'm trying to squeeze as much perf as i can out of hot paths. this seemingly simple fetch operation consumes about a third of the CPU time: ```cs private byte Fetch() { return _memory.Read(Registers.PC++);...

Displaying in App isn't working as intended.

Hello can someone pin point what I am doing wrong here? ``` public void DisplayEquipment() { Console.WriteLine("\n=== Equipment Status ===");...

ListView column help (How to autosize, align content and add column lines?)

This is my current GUI (Using ModernWpf), I've done a lot of Googling and I can't seem to find a way to do the following: 1) Vertically align the text in the 'Name' column to be centered 2) Horizontally align the ComboBox in the 'Voice' column to be centered 3) Make the ComboBoxes to automatically have the size of the longest option...
No description

Node process not being killed properly when WPF closes

I have a client and a server process running in the background that's being spawned using C# in WPF but they're not being killed when I want them too.

✅ Local Post, 400 Bad Request. Can't figure out why?

Hey so I have a save button my website that uses JS to do a POST request to the server so tat I can update / add a command for the user, but I can't seem to figure out why I'm getting this error? I'll post some screenshots as a comment so they are formatted better

✅ [Nuget] How to find the latest version of a package?

In GitHub action workflow, I need to find the latest stable version of this package:https://www.nuget.org/packages/microsoft.web.webview2 First, I found this endpoint (https://api.nuget.org/v3-flatcontainer/Microsoft.Web.WebView2/index.json) that list all the version, but like you can see, it also includ the pre-release version, so I cannot use it. I also found this endpoint (https://api.nuget.org/v3/registration5-gz-semver2/microsoft.web.webview2/index.json) which give more info about each version, but it doesn't tell me if it is a prerelease or not...

✅ What is the use of `LogLevel` type in C#?

I have also tried to use this type by adding the using Microsoft.Extensions.Logging; directive, but this shows me an error that the Extensions type does not exist in the Microsoft namespace. How to use this then?

✅ Does anyone know how to fix the error below

Severity Code Description Project File Line Suppression State Error (active) CS1061 'ToastContentBuilder' does not contain a definition for 'Show' and no accessible extension method 'Show' accepting a first argument of type 'ToastContentBuilder' could be found (are you missing a using directive or an assembly reference?) PCMonitor F:\App Development\PCMonitor\AlertReceiver\Services\NotificationService.cs 13...

Trying to embed custom font in WinForms project

I'm currently trying to embed the 'Rubik' font onto a WinForms project following the steps on the correct answer in this SO post: https://stackoverflow.com/questions/556147/how-do-i-embed-my-own-fonts-in-a-winforms-app I include the font non the Resource Explorer of the project and then mark the generated .ttf on resource as an Embedded Resource but then the project doesn't build due to the error 'Could not find a part of the path D:\Documents\Workspace - C#\FactuCrossing\FactuCrossing\Properties\Resources\Rubik-VariableFont_wght.ttf and ```Invalid Resx file. System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\Documents\Workspace - C#\FactuCrossing\FactuCrossing\Properties\Resources\Rubik-VariableFont_wght.ttf'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)...
No description

Trying to understand required members

I can't seem to set the value of a required member through a subclass's constructor. https://dotnetfiddle.net/Gz6b7M Any help is appreciated....