friedice
friedice
CC#
Created by reeeeeee on 10/18/2024 in #help
When to use Dependency injection?
DI makes unit testing 100x easier and makes your code more modular. Personally haven't worked with WPF much, but I believe in the motto of use it as you need it.
5 replies
CC#
Created by KitStead on 10/10/2024 in #help
Blazor - Can we OnValidSubmit for every control change?
8 replies
CC#
Created by KitStead on 10/10/2024 in #help
Blazor - Can we OnValidSubmit for every control change?
What's the use case for this? Validation?
8 replies
CC#
Created by KitStead on 10/10/2024 in #help
Blazor - Can we OnValidSubmit for every control change?
What do you mean by any control, on any input change?
8 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
This would be the skeleton for your application flow, nothing too complicated.
using System;

class Program
{
static void Main(string[] args)
{
bool running = true;
while (running)
{
Console.WriteLine("Enter 1 to call Function1, or 2 to exit:");
string input = Console.ReadLine();

switch (input)
{
case "1":
Function1();
break;
case "2":
running = false;
Console.WriteLine("Exiting the program...");
break;
default:
Console.WriteLine("Invalid input.");
break;
}
}
}

static void Function1()
{
Console.WriteLine("Function1 is called!");
}

}
using System;

class Program
{
static void Main(string[] args)
{
bool running = true;
while (running)
{
Console.WriteLine("Enter 1 to call Function1, or 2 to exit:");
string input = Console.ReadLine();

switch (input)
{
case "1":
Function1();
break;
case "2":
running = false;
Console.WriteLine("Exiting the program...");
break;
default:
Console.WriteLine("Invalid input.");
break;
}
}
}

static void Function1()
{
Console.WriteLine("Function1 is called!");
}

}
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
yeah there isnt really an easy fix, just rewrite imo
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
you can put keyword "static" right before int over() but your program might infinitely recurse and crash due to stack overflow
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
well the flow is all messed up in the first place, which is why i recommended creating a new projet
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
lets work on getting the application flow working first, being able to run the project helps. Personally, i would recommend creating a new console project and getting the while loop going
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
a way to do this would be a static integer, something like
static int num = 0;

void Foo()
{
num += 10;
Console.WriteLine("Score: " + num);
}
static int num = 0;

void Foo()
{
num += 10;
Console.WriteLine("Score: " + num);
}
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
the easiest way is to put it in memory during application runtime
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
so on init, have something like Hi user. press following button to do stuff. 1. Do Foo 2. Exit and 1 will direct them to input whatever they need "team name", "number" and will output that number, then direct them back into the main while loop
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
and exit the program whenever as well
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
so that user can running the logic for firing that inning function based on a certain criteria whenever user wants
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
so maybe instead of a for loop, you can have your application running with state machine logic. ie while loop.
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
first, what are your expected inputs?
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
it's easier to break down the problem into mini problems
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
expected inputs, logic that needs to be done, and output
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
i would recommend white boarding out your solution before writing any code
188 replies
CC#
Created by 'brella boy on 9/30/2024 in #help
errors that i cant figure out for the life of me
yeah I recommend learning the basics first, learning the syntax etc.
188 replies