Tuesday, 15 February 2011

.net - Split a List into parts - VB conversion fails -


is trying to write a method that divides the list into separate lists.

  return the list of the list (string of) in the form of list (string of) as the list (string of) in the form of SplitIdsIntoChunks (list) (key of the string). , I) {key index = i, key with value = x}) _groupby (function (x) (x index / 10000)). Select (function (x) x.Select (function (v) v.Value). Ollist ()) _. Ollist () and function  

I used the C # solution C # solution works fine.

My version of VB gives a collection of lists with an element instead of 10000. Where did I go wrong?

Thanks in advance.

Edit1:

Usage:

  Due to the list of string (string) = SplitIdsIntoChunks ( Keys)  

'Keys' content:

here Enter image details

My list of lists of lists lists inside an item:

Expected Result: List of two lists - 10000 items in the first and 6256 in the second.

x.index / 3 In the standard division / , there is always a double result in VB and therefore there is a unique group for each item eg: .33. , .333333, .333334} etc.

'To achieve integer results, use' move 'to the integer division \ To create flexible and reusable, a chunksize argument has also been added:

  Private function splitinTunes (as list (as string), Chunky Select the Return key as the list (in the form of the integer) return key (function (x, i) with new {key index = i, key.value = x}. Groupbie (function (x ) (X. index \ chuxise). Select (function (x) x.Select (function (v) v.Value) .Olist ()). ToList () End function  

Another difference is that the code is very flexible about line continuity, so dot one line VB may be the beginning or the end of the VB (VS02010) member qualifier character (dot . ) supports unbalanced line continuation after so that you can get rid of clear line continuity ( "_" ).

Usage:

  300 split dimming into split list of 1000 * split intoton (merist, 300) to divide = 0 as integer . Calculation - 1 console. Light line ("split {0} has {1} items", n.ToString (), partition (n). Count) next  

output / result:

Split 0 has 300 items - Split 1 has 300 items - Split 2 has 300 items - Split 3 has 100 items

Keep in mind There is very little comment on the linked C # post regarding the performance of various methods. It just works, it can perform better on the basis of some options are actually being divided. This is also interesting.


No comments:

Post a Comment