❔ hi everyone what
i need help in c#
what is get and set ,
and what is a args,
and sender? any body can help me!
9 Replies
get
and set
are "accessors" for properties. you can individually assign logic to them to verify input and output for them. you can also omit one or the other, or give one a different accessibility
$structure
For C# versions older than 10, see
$StructureOld
a property could be for example;
you can also do
this won't have any validation of the input or output, this is called an auto-property
but it's only assignable from the current class it's in
args
is usually a string[]
or an object[]
(string array, object array) that gets passed into the entry point of the program (the Main
) method. it doesn't need to be there, but it can. for console apps, the args
will be all additional information passed into the execution of your program
$mainsThe possible signatures for
Main
are public
is not required (can be any accessibility).
Top-level statements are compiled into a Main
method and will use an appropriate signature depending on whether args
is referenced, the await
operator is used and/or an explicit return
statement is used.
https://docs.microsoft.com/en-US/dotnet/csharp/fundamentals/program-structure/main-command-lineMain() and command-line arguments
Learn about Main() and command-line arguments. The 'Main' method is the entry point of an executable program.
for example, a console app can be started with
YourProgram.exe arg1 arg2
the resulting args
array will be a string[]
where item 0 is "arg1"
and item 1 is "arg2"
sender
(in the context of a winforms app) is the object which caused the invocation (raising, execution) of the eventno i mean like
yes
in this example,
sender
will be the Slider
which raised the OnSliderValueChanged
eventthanks
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.