dankmememachine
❔ How would I call a method created as a top level statement outside of the initial file?
I have Program.cs with a method that is a static int, and have tried to call it in a new file called Test.cs, by calling but get the error: Cannot use local variable or local function declared in a top-level statement in this context
19 replies
❔ How to get specific fields from a Http GET request
I am working with a test API for learning purposes, I am using the following snippet to actually return the request body:
I get a response such as:
How could I go about getting a specific field from this output, such as the "name" or "images"?
208 replies
❔ How to format float to currency
I am multiplying small numbers (0.08 - 0.18 etc) and getting numbers like 34.44241. I want to figure out how I can multiply these values in terms of USD to be able to come out with a dollar and cent amount.
29 replies
❔ How to call a method that uses a struct in it's definition?
I program in C# with Unity most-often, I am branching out to 'normal' C# and am stuck on connecting a method to main in a practice project. is used to define this method: and I cannot find a way to run this in Main to actually begin working out the results. Any help would be greatly appreciated!
65 replies