Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

There is a method that checks if a name already exists :

bool Foo(string name) {
  return Names.Contains(name)
}

What would be the best name for this method?

share|improve this question
1  
Sorry, but a single word request is not a Code Review. Feel free to open a question on Code Review Meta if you'd like to make an argument for including this in the scope, but for now it is off topic. – codesparkle Feb 27 at 19:58

closed as off topic by almaz, codesparkle Feb 27 at 19:50

Questions on Code Review Stack Exchange are expected to relate to code review request within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

2 Answers

up vote 3 down vote accepted

It depends on what Names is, where it's populated, and so on.

Possibilities include IsExistingName(), NameAlreadyExists(), IsPreviouslyProcessedName(), and so on. Basically, anything which makes sense after the word "if" (after filling in prepositions) is a good function name.

  • "If [it] is [an] existing name..." -> IsExistingName()
  • "If [the] name already exists..." -> NameAlreadyExists()
  • "If [it] is [a] previously processed name..." -> IsPreviouslyProcessedName()
share|improve this answer

I'd consider isNameExist(string name).

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.