I was splitting RenameFolder to two pieces and i notice visual studios 2010 supports named parameters! (example below).
I know this has existed for a number of years in other languages. I remember a professor saying why he likes named parameters and that he uses them in all of his code. But i am sure its not in all of his code. I was wondering.
When should i consider to write the function using a named parameter vs normal style (func(a,b,c)
). Some cases area (without a when and when not suggestion)
- Calling public methods in the same class
- Calling private methods in the same class
- Calling methods in external 3rd party libraries
- Calling methods in another class in the same namespace
- Calling methods in another class in a different namespace or module
Calling methods from internal classes not meant to be a library
public bool RenameFolderIn(PK folderId, string newfoldername) { return RenameFolder(newfoldername: newfoldername, infolder: true, folderId: folderId); } public bool RenameFolderOut(PK folderId, string newfoldername) { return RenameFolder(newfoldername: newfoldername, infolder: false, folderId: folderId); } public bool RenameFolder(PK folderId, string newfoldername, bool infolder) {