❔ Copying video on Delegates, why doesn't my version work?
Why does my code not work, but the code in the video i'm following does.
26 Replies
Idk, what's the error?
Well, the difference, then, is that
Start()
in the video is not static
, while your Main()
is
You can make your Testdelegatefunction
field static
Same for the TestBullshitDelegate
methodhmm
so why did main being static stop it working?
i thought that just means you cant instantiate a new object of it
is there another way around it without making the field and method static?
ok that also fixes it
thanks for the help
There is a way, creating your own, separate non-static main
Gimme a second
And you only work with the
App
class, not touching Program
and Main()
=> new App().Run(args); what's this syntax called
lambda expression?
these seem to have different rules in different scenarios
dont have them all memories properly
Expression-bodied method
it doesnt require something on the left of it?
The signature of the method is to the left
thats usually the arguments on the left right?
is the same as
It's not an anonymous function/lambda
Just a shorthand for writing one-liner methods
Angius#1586
REPL Result: Success
Result: int
Compile: 432.017ms | Execution: 36.994ms | React with ❌ to remove this embed.
i wish they would pick something different than => when its a different thing
Yeah, that's a valid concern
so its saying execute/return the following
but it only works if its 1 line?
Yep
alright cool
gotta smash that into my brain
Or, well, one statement
for example is multiple lines, but it's a single statement
right, it's everything chainged up in one statement ended by one ;
how are you getting the comments to format your code?
int Whaetver() => 1
is there a page somewhere that shows you
i cant see it
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
If your code is too long, post it to: https://paste.mod.gg/$codegif
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.