What is the best practice for naming private and static private methods in C#?

Mark Rogers picture Mark Rogers · Apr 4, 2009 · Viewed 13k times · Source

I'm trying to figure out what is the smartest way to name private methods and private static methods in C#.

Background: I know that the best practice for private members is underscore-prefix + camelcase. You could argue this with me, but trust me I've seen enough code from hardcore pros that follow this convention, it is the skilled industry standard.

I also know that pascal case is the industry standard for public methods. But I have seen a combination of test style naming (ie. method_must_return_false_occasionally ) to pascal case, camelcase, and underscore-prefix + camelcase, for private and private static methods.

But what is the best practice style for private and private static method naming in C#?

If there are certain styles that are used from some private methods and not others, I can understand that, just explain.

Thanks for reading.

Answer

bendewey picture bendewey · Apr 4, 2009

Check out the Microsoft's Naming Guidelines and Brad Abram's Style Guide

They say that all methods should be PascalCase

public void DoWork() {}
private void StillDoWork() {}
private static void ContinueToDoWork() {}