Starlk
Starlk
CC#
Created by Starlk on 4/18/2023 in #help
❔ a question about generics
vague title because I don't know how would I word it
void Welcome<T>(T message) where T : Parent<T> { }

internal abstract record Parent<T>();

internal sealed record Child() : Parent<string>;
void Welcome<T>(T message) where T : Parent<T> { }

internal abstract record Parent<T>();

internal sealed record Child() : Parent<string>;
this might be a weird question, but how could I achieve something like this:
Welcome<Child>("string");
Welcome<Child>("string");
where the provided T type might change the message type, for example, if Child was Parent<int> then Welcome<Child>() would for an integer
24 replies
CC#
Created by Starlk on 9/22/2022 in #help
Optimizing Memory Usage
I've a tool that basically takes a bunch of files and converts them to a GIF. The way it works is that the files it reads are in binary and each byte represents a color, I start by reading the whole file then create a SKBitmap and SKCanvas to draw each pixel, then I add it to a MagickImageCollection that finally writes everything to a GIF, the tool works perfectly fine but I kind of hate of it uses almost 200 MB of RAM just with 40 files. https://pastebin.com/PPivEW9P
24 replies
CC#
Created by Starlk on 9/9/2022 in #help
System.AccessViolationException
I'm trying to create a simple multiplayer game using SignalR and Raylib, I wrote a really simple demo to just test things out https://paste.mod.gg/vurhhzhnueak/0 (This is the entity class https://paste.mod.gg/rrdqrlumtmag/1), and it actually works but that is until I try to open another instance of the same program, which cases it to throw an System.AccessViolationException exception @ line 49 Raylib.ClearBackground(Color.WHITE);, any idea what's causing it?
4 replies