Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mystical "F colon" in c#

Tags:

syntax

c#

I was working on refactoring some c# code with ReSharper. One of the things I've run into is a c# operator that I'm unfamiliar with.

In my code, I had this

Mathf.FloorToInt(NumRows/2)

where NumRows is an integer. ReSharper suggests that I should change it to

Mathf.FloorToInt(f: NumRows/2)

I'm pretty sure that f: is some flag that tells it to cast NumRows as a float but I cannot find any documentation for f: online. Can anyone elaborate on what exactly f: does or link me to a MSDN page about it?

(Although I have a good idea of what f: does, it's hard to search the internet for a colon, and I'd like to know what it does before I use it)

Update 1: Regardless of what I'm trying to do, I'm interested in the f-colon syntax

Update 2: Turns out it was actually Visual Studio suggesting that I could add the argument name 'f' not ReSharper, but that does't change the correct answer..

like image 705
Perchik Avatar asked Jul 23 '12 17:07

Perchik


1 Answers

It's a named parameter. Look at the defintion of Mathf.FloorToInt, it will have a parameter named f.

Resharper is indicating that the code could be made more readable by using a named parameter in this case.

like image 91
Brian Rasmussen Avatar answered Oct 25 '22 17:10

Brian Rasmussen