cheeze2000
cheeze2000
CC#
Created by cheeze2000 on 11/16/2024 in #help
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.
16 replies
CC#
Created by cheeze2000 on 11/13/2024 in #help
✅ MemoryStream question
If I have a byte[], and I'm instantiating a MemoryStream with this byte array, does it occupy twice the memory? Or is the MemoryStream simply referring to the byte array instead of copying the contents in the array?
6 replies
CC#
Created by cheeze2000 on 8/1/2024 in #help
Aggregate data grouped by a key
I'm looking to aggregate these data:
// from this
[
new { id = 1, qty = 3 },
new { id = 2, qty = 5 },
new { id = 1, qty = 10 },
]

// to this
[
new { id = 1, qty = 13 },
new { id = 2, qty = 5 },
]
// from this
[
new { id = 1, qty = 3 },
new { id = 2, qty = 5 },
new { id = 1, qty = 10 },
]

// to this
[
new { id = 1, qty = 13 },
new { id = 2, qty = 5 },
]
my current approach iterates over the list into a dictionary and check for duplicate keys. i have a feeling it can be done in a cleaner way with System.Linq stuff
5 replies
CC#
Created by cheeze2000 on 5/6/2024 in #help
✅ Character Info Lookup?
No description
3 replies
CC#
Created by cheeze2000 on 5/1/2024 in #help
assure compiler type is not null
No description
33 replies
CC#
Created by cheeze2000 on 4/20/2024 in #help
✅ Don't quite understand the `required` keyword
No description
16 replies
CC#
Created by cheeze2000 on 4/18/2024 in #help
Creating a function that accepts either string or byte[]
i have some function that is supposed to perform AES 256 encryption, EncryptAes(byte[] plaintext, byte[] key) the problem is i want this function to accept either string or byte[] but then i have to declare 3 other function overloads. So my approach was something like EncryptAes(EncryptionInput plaintext, EncryptionInput key) and then a bunch of public static implicit operators. is this a good approach?
4 replies
CC#
Created by cheeze2000 on 4/14/2024 in #help
How can my out parameter be nullable?
No description
20 replies
CC#
Created by cheeze2000 on 3/5/2024 in #help
Help me with my concurrency experiments
Correct me if I'm wrong. Based on my understanding, a CPU with 1 core running 1 thread has the same computing power as another CPU with 1 core running 2 threads. The latter will handle 2 tasks but each task will roughly have half of the computing power. Is there anything in C# I can do to simulate this? Perhaps a function that exits after a certain amount of CPU cycles.
4 replies
CC#
Created by cheeze2000 on 1/13/2024 in #help
need help understanding `Task`s
if my CPU has 6 cores and 12 threads, how many Tasks can run at once?
79 replies