Funksiyaning nomlari qisqa va aniq bo'lishi kerak shu bilan birgalikda u nima vazifani bajarishi haqida qisqacha ma'no anglatishi lozim.
Funksiyani nomlashda u nima vazifa bajarishiga qarab, shunga oid kalit so'zlaridan foydalanish kerak.
public List<Student> GetStudents()
{
...
}
public List<Student> Students()
{
...
}
Asinxron funksiyalar Async
kalit so'zi bilan tugashi kerak va u funksiya Task
yoki ValueTask
tipida qiymat qaytaradi.
public async ValueTask<List<Student>> GetStudentsAsync()
{
...
}
public async ValueTask<List<Student>> GetStudents()
{
...
}
Kiruvchi qiymatlar obyektning qaysi xususiyatiga tayinlanishi yoki keyinchalik qidirib topish uchun ham aniq bo'lishi kerak.
public async ValueTask<Student> GetStudentByNameAsync(string studentName)
{
...
}
public async ValueTask<Student> GetStudentByNameAsync(string text)
{
...
}
public async ValueTask<Student> GetStudentByNameAsync(string name)
{
...
}