Tell the beginner how to write methods. In language, they are written according to tradition with a capital letter, but access methods are written with a small one. It is about c #. What is the motive of such an exception for these methods?

  • four
    These are the keywords, we have all the keywords written in small letters - Andrew NOP
  • Strictly speaking, the style of writing code is set by the team (you can set your own style in your team from at least one) and write at least in camelCase, at least in the snake_case and the third case, that it will be inconvenient to read to an outside team. But with keywords you have no choice, as the language developers decided to name the keywords, so you will write them. Well, it is necessary to distinguish keywords and identifiers for which agreements can be just - Andrew NOP
  • The names of the properties you give yourself. And get and set are not names, they are accessors . - Alexander Petrov
  • By the way, if you want to redefine keywords in the language and create new ones, then just take another programming language that allows such a feature. - Alexander Petrov

1 answer 1

In general, how to write the name of the method is your whim. But keywords (and all) in C # are written in lower case letters. And no one will give you an exact answer, since the creator of the language decided so. I do not think that a couple of words in the language are always written in lowercase letters, this does not affect your working capacity, does it?

  • 3
    it seems not a whim, but the style of writing methods with a capital letter, but the answer with keywords on the one hand clarifies the situation, and on the other they still play the role of methods. - 4uva
  • one
    @ 4uva is not well get and set are primarily keywords, and then they function as access methods for variables - Aqua
  • one
    Your answer - as if it goes without saying. But specifically for such questions, you must either not answer, or respond with links to standards, ECMA, or at least MSDN. Otherwise, the simple question "why is it so, and not so" you get into a dead end. - nick_n_a
  • The question is answered, by the way, the joke reminds me - do you always answer the question with a question? - why? :)))) - nick_n_a