C# - Simple Count elements inside For each () -


is correct way count amount of elements displayed in each?:

 var sql = db.query("select * userprofiles fullname @0 , role = 'student' ", search);   @foreach (var nom in sql){         if (nom.count() == 1){            @nom.name + info         }else{            @nom.name         }  } 

you're taking count of nom instead of sql.

if (sql.count() == 1){  // <= here    @nom.name + info   }else{    @nom.name } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -