A quick search through the compiler source code shows that the name CallerMemberName
does not appear anywhere in the code, so I think this feature is not supported. (You can certainly mark a parameter with the attribute, but these attributes are special - they instruct the compiler instead of being discovered and used in some way at runtime.)
Update July 2016: As of late June, F# now supports CallerLineNumber
and CallerFilePath
, but CallerMemberName
is still absent. It seems like that one in particular is more difficult to implement, unfortunately.
On a related note, F# has a few special identifiers that let you get the current source file name and line number, so you might be able to get similar information with __SOURCE_DIRECTORY__
and __LINE__
(but not from the caller as in C#).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…