Possible Duplicate:
What does the @ symbol before a variable name mean in C#?
I have been coding in C# for about a year now, and recently i came across the following
public bool OnPreUpdate(PreUpdateEvent @event)
As you can see event has an '@' sign before it, is this just to prevent the compiler detecting it as the event type, therefore does '@' gets treated as any other text or is there a special meaning to it?
It is a Generic Type Parameter. A generic type parameter allows you to specify an arbitrary type T to a method at compile-time, without specifying a concrete type in the method or class declaration.
An in-parameter is information being passed from the caller to the function. For small things, such as integers or real numbers, you usually use call by value for an in-parameter.
Discards are basically temporary variables or dummy variables that are not used in application code. The main purpose of discards is to provide a reusable variable, which decreases the memory allocation and improves readability and maintainability.
Starting with C# 7.0, C# supports discards, which are placeholder variables that are intentionally unused in application code. Discards are equivalent to unassigned variables; they don't have a value.
An @
sign lets you use C# keywords in identifiers; if you remove the @
then you'll get a syntax error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With