假设您有一个缓存,以及一个将执行以下操作的方法:
if (wanted Foo is not in cache) cache.Add(new Foo()) Return Foo from cache
你会怎么称呼这种方法?GetFoo(),GetOrCreateFoo()还是其他什么东西(更好)?或者这真的应该分为两种方法吗?
GetFoo()
GetOrCreateFoo()
naming-conventions
naming-conventions ×1