c# - Do these two functions both create collections of Classes? -


i've written piece of code in c# can create collection of classes , stores them in array. know code works , job fine , i've been using store results database display.

now need replicate same behaviour using vb.net , after google-ing appears i've found closest solution.

i've run c#code through translator (c# vb.net) did not give me correct result , produced error when placed inside collection class.

here's code:- c#

using system; using system.collections.generic; using system.collections.objectmodel; using system.linq; using system.text; using system.threading.tasks;  namespace knightowl_businesslogic.dataobjects.animal_module {     public class animalcollection : collection<animal>     {         public animal[] toarray()         {             animal[] array = new animal[this.count];             this.copyto(array, 0);             return array;         }     }  } 

vb.net:

imports system.collections.generic imports system.collections imports system.collections.objectmodel  namespace datamodels      public class visitorlistcollection          public visitorlist new collection          private sub addvisitor()             dim tempvisitor new visitor()             visitorlist.add(tempvisitor)         end sub      end class  end namespace 

it builds no errors i'm not convinced going doing same job.

your c# code creates fixed size array of items. vb.net code creates list of items. both 'collections' vb.net example creates collection can add more items to. may or may not want.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -