c# - Functions should start with "Get"? -
I am trying to see C # coding standards to make my code more beautiful and standard, and I have There is a question: According to the C # coding standards, should the work (methods which are not viable) start with "gate"? For example: " GetSongOrder ()
", " GetNextLine ()
" etc?
Thank you.
There are two cases:
If without the side effects in the routine code, Get the value, I recommend using a property recipient, and leaving the name "GO":
public song order song order {get; This.songOrder; } // i.e.: an enum}
If the required processing is required, then a method is appropriate with the name "Receive ...". This suggests that there may be side-effects to call this method, such as additional processing, or changes in some state:
public string GetNextLine () {string line = this.stream. ReadLine (); // This can be a long lasting task, especially if this disk is using IO / etc // do other work? Return line; }
Comments
Post a Comment