Emelie
❔ WHY is my app not running?
https://github.com/EmelieH-cloud/WPF-timer
This is driving me nuts. I have created a grid with a timer, and on run, the grid should be filled with generated buttons and the timer start. But when I try to run it, I get no window and no errors. Just completely blank. What am I doing wrong?
24 replies
❔ Property vs field?
Hi everyone,
I have a really basic but also really important question regarding C#. I have been coding for some time now, and I am using properties and fields as I have been instructed to in my classes, but still I don´t really grasp the difference. What is actually the difference? been reading online but these explanations don´t seem to do it for me :/
54 replies
❔ I don´t understand this line of code at all (random char letter)
Hi, I am finding it really hard to understand how its possible to randomize a letter like this:
Random rnd = new Random();
char randomChar = (char)rnd.Next('a', 'z');
I thought that the Next() method only could take int's as a parameter?
20 replies
✅ What is IEnumerable<out T> ?
Hi! I have written this code which works, but I dont understand what type of value 'var myQuery' actually is. Is it an array containing
the filtered values?
// Data source.
int[] numbers = new int[] { 34, 57, 89, 12, 4, 6, 7, 123 };
// Data query. <---MY QUESTION
var myQuery = numbers.Where(number => number < 10);
// Data Execution.
foreach (var number in myQuery)
{
Console.WriteLine(number);
}
175 replies
❔ Help me understand this lambda expression
var myKey = availableProducts.FirstOrDefault(x => x.Value == input).Key;
Console.WriteLine("Quantity: left " + myKey);
Im trying to understand how this code works (how it gets the key for the input value in a dictionary). Been searching the web but not really getting more clear.. mostly I dont understand the use of "x". Many thanks for any help!
105 replies
❔ How do I take textbox input and make an object out of it, then add it to an array?
Here is my code : https://paste.mod.gg/nojduzpnglow/0
32 replies