I’m trying to look at the C# Coding Standards to make my code more beautiful and standard, and I have a question: Does functions (methods that are not voids), according to the C# coding standards, should start with “Get”? For example: “GetSongOrder()“, “GetNextLine()” etc?
Thanks.
There are two cases:
If the routine can “get” the value very quickly, without causing side effects in the code, I recommend using a property getter, and omitting the “get” name:
If, however, there is processing required, then a method with the “Get…” name is appropriate. This suggests that there may be side effects to calling this method, such as extra processing, or a change in some state: