In the F# language it is possible to name functions using ``Ticked function name notation``
. It is extremely convenient for unit tests naming.
Is there any possibility to do this in the C# language? We can always use Underscored_method_names
or PascalMethodNames
, but it isn't as easy to read.
No, basically. C# type and member names cannot include whitespace (and cannot start with a number). There is support for disambiguating names from reserved keywords (the @
prefix), but that is about it.
When the long name is for display, often DisplayNameAttribute
is useful, i.e.
[DisplayName("My class")]
public class MyClass {
[DisplayName("Full name")]
public string FullName {get;set;}
}
Putting actual spaces (ASCII 32) in identifier names is not possible.
However, see this blog about (ab)using Unicode to insert other code points that look like spaces. The author describes a way to somewhat automate this using hotkeys.
I do not recommend you do this as it will cause serious problems with maintainability and debugging.
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