© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
9 replies
knut.wannheden

primary constructor naming convention

Hi!
I was wondering if there is a naming convention for primary constructor parameters on a class. Let's say I have
class Point(int x, int y)
class Point(int x, int y)
and now I want to add a method to this class with an
int x
int x
parameter. AFAICT I then can't really resolve the name conflict between the two in the method body, so I was wondering if I should rename the primary constructor parameters to e.g.
_x
_x
and
_y
_y
or if I should instead rename the method parameter to avoid the conflict.
Thanks!
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Naming convention question
C#CC# / help
3y ago
Primary Constructor
C#CC# / help
5mo ago
❔ File naming convention preference
C#CC# / help
3y ago
`required` vs primary constructor
C#CC# / help
8mo ago