Skip to content

Primary Constructors and private fields naming convention #7565

Answered by HaloFour
philfontaine asked this question in Q&A
Discussion options

You must be logged in to vote

Primary constructor parameters aren't fields as far as the C# language is concerned. They are captures, and the actual mechanism used to capture the value of the parameter beyond the lifecycle of the constructor (if necessary) is an implementation detail. So I think the naming guideline would be to treat them as normal parameters, as you would do with method parameters that are captured by lambdas.

Replies: 1 comment 19 replies

Comment options

You must be logged in to vote
19 replies
@DavidArno
Comment options

@baterja
Comment options

@CyrusNajmabadi
Comment options

@baterja
Comment options

@HaloFour
Comment options

Answer selected by philfontaine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet