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
Post a Comment