c# - Can't get the right datatype to pass parameter by reference -


i need here, keep receiving error ... has invalid arguments in part:

this.search(ref objresult, ssql);   

i can't pass collection reference.

internal override models.basecollectionmodel<models.categorymodel> onfind(string objqueryargs) {     models.collection.categorycollectionmodel objresult = new models.collection.categorycollectionmodel();     string ssql = string.empty;      ssql = "select * " + this.tablename;      this.search(ref objresult, ssql);                  return objresult; }  internal virtual void search(ref system.collections.ienumerable  objresult, string squery) {     //statement goes here... } 

just additional info categorycollectionmodel inherits from
models.basecollectionmodel<models.categorymodel> inherits system.collections.objectmodel.observablecollection<t>

make type objresult ienumerable, per method declaration:

system.collections.ienumerable objresult =  ^------+----------^        |        +- right using directives, part redundant 

a ref parameter has match declaration, can't assignment compatible, has exact declaration.

the reason method swap out content of variable different value, of same type, not guaranteed categorycollectionmodel.

here's control question: do need ref?

why have ref parameter? because want reference collection, , not copy of collection? or intend switch out collection different one?


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -