D.Mentia
D.Mentia
CC#
Created by SwagSek on 11/6/2024 in #help
✅ Can you make labels scroll alongside input?
I agree that smaller font would be best, and/or a scroll bar for it.
Otherwise, if you don't like those ideas, you mention it's a label, so it might help if the text goes into a text box component instead of a label, then right align might do it automatically. Users could also type in the numbers directly, but be careful they don't type in random C# code that you execute If it is a label, autosize, text align right, and anchor right, should let it extend to the left as it gets longer, and then it would end up under the gray area if z-ordered correctly and 'cut off' the left side
54 replies
CC#
Created by workani on 10/25/2024 in #help
Converting a string to a list of objects using only LINQ.
If you can control the input format, probably just make it json, it's much simpler. Otherwise something like
var myObjects = myString.Split('\n').Select(x => new ShoppingItem(x, false));
var myObjects = myString.Split('\n').Select(x => new ShoppingItem(x, false));
but you may have problems with line endings sometimes being \r\n or \r or \n ... also notably, it doesn't make sense for one entry on a shopping list to be a ShoppingList
24 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
I explained them above if you need it worded a different way https://discordapp.com/channels/143867839282020352/1292841177971953674/1292859785363853395
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
Deferred execution. Define a method now, let someone else (or somewhere else) run it later
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
(which probably didn't make it easier :lul: )
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
but maybe you'll start to like it, you're not really at the point where it's fun yet
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
and I'll recommend that if you don't like programming, don't do it as a job 😛
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
and that someone else would find it very convenient that they can just tell you what to do in your method (by passing you a method)
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
basically pretend that every method you write is a method someone else is going to call
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
often when we say things like "you don't know X", what we mean is that you should pretend you don't know X because X is handled somewhere else, it's not your job right now, and in theory someone else might be the one writing X, not you
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
you can write one method that just, asks for some numbers, and calls whatever method was given to it. And later, you (or someone else) can write the method that gets sent to it
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
... yeah that probably didn't help lol, what I mean is it helps you be able to split things up and not have to think about all of it
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
when your programs get big and complicated, the 'you' that writes one method might be you from a month ago and not the same you that's writing the second method 😛 and so that second you doesn't know what the first one does anymore
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
timers are still probably a good example of when they are quite useful, if you wanted it to add those numbers 10s later, and you subtract them now, that timer has to be given a delegate so it knows what to do in 10s
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
But imagine or maybe write it the other way around, where you first ask if they want to add or subtract. Then you call HandleInput(calc.Add) or (calc.Sub), and HandleInput is a method that asks for those numbers and just calls whatever method was passed to it
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
This is still the same kinda bad example of a use case as before
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
it'll return false, and numbers will (at that point) exist but be 0, the default value, which is why you have to do the if check. So you can tell if they actually put in 0, or if it just couldn't read a value
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
but whatever works
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
I'm a fan of just
do {
Console.WriteLine("Enter a number")
} while (!int.TryParse(Console.ReadLine(), out int numbers))
do {
Console.WriteLine("Enter a number")
} while (!int.TryParse(Console.ReadLine(), out int numbers))
375 replies
CC#
Created by Merineth 🇸🇪 on 10/7/2024 in #help
✅ Delegates. What are they and what are they used for?
yep
375 replies