having issues carrying variables to methods

i cant quite figure it out
19 Replies
Jamster3388
Jamster33882y ago
so im making a simple rpg game and im trying to save the variables to a method that displays character info ((i know it needs refining id like to just get it working
Jamster3388
Jamster33882y ago
Jamster3388
Jamster33882y ago
thought id take a better screenshot
Down
Down2y ago
specify type of varriables you want to recieve
Jamster3388
Jamster33882y ago
In the ()?
Down
Down2y ago
static void WriteSomething(string text) {
Console.WriteLine(text);
}
static void WriteSomething(string text) {
Console.WriteLine(text);
}
Jamster3388
Jamster33882y ago
So if I’m calling a variable I have to do it with every static method?
Down
Down2y ago
how can you call a varriable you defined your methods inside Main method move them out and then call them inside Main
Jamster3388
Jamster33882y ago
Ahhhhhh I get it now So you kinda enable those variables per method And specify it
Down
Down2y ago
kind of
Jamster3388
Jamster33882y ago
So you can specifically define which variables per method
Down
Down2y ago
also if you want to use those properties
Down
Down2y ago
you need to make them static as well
Jamster3388
Jamster33882y ago
So change them from public?
Down
Down2y ago
public is fine just add static public static float ...
Jamster3388
Jamster33882y ago
Ah ok what will making it static do?
Down
Down2y ago
that you can use it in static methods and all your methods must be static if you want to call them inside Main since main must be static method complicated stuff
Jamster3388
Jamster33882y ago
ah il figure it out lmao but yeah that fixed a lot of stuff and i learnt something very useful thanks!
Down
Down2y ago
np
Want results from more Discord servers?
Add your server
More Posts
❔ xamarin listview doesnt updatehi so i have a weird problem in my code behind i have 2 methods ```cs private void SearchLis❔ Touch number pad in Windows 11Hi, I'm trying to find out, how to get this number pad. Problem is, I'm creating cash system, which ❔ my delegate event is not raising the eventi defined a event in my CustomerViewModel to pass the data to my main viewModel and raise a new evenError with app send emailThe goal is to make a send emails app from c# , later on to also send with attachments but im stuck ❔ Can someone help me with my snake game?Hi everyone reading this. I’m pretty new to C#, so please go easy on me. I have a snake-game (wpf)✅ ConsoleApp - run the .exe by cmd and catch given parametersWell, as a little task I'm trying to code a ConsoleApp that should base64 encrypt an input string ~~❔ Bad IL Format Exception when porting .NET Framework 4.8 Project to .NET Core 6.0Hi, I've currently got the glorious task to port a .NET Framework 4.8 project to .NET Core 6.0. So f❔ "Cannot assign requested address [::1]:27017" when connecting to MongoDB on Docker.I have a Docker Compose file with containers - `backend`: ASP.NET Core web API - `mongo`: MongoDB wh❔ External Login Callback (Facebook works, Google doesn't)This is copied from a youtube tutorial and I've been trying to step through and figure out the probl❔ Need someone who is an expert at rating resumes, would really appreciate itMy resume https://cdn.discordapp.com/attachments/684475244664193242/1065827594806763580/Yehor-Belenk