Skip to content

Operate with the combinations in vb.net #19

@tgab11

Description

@tgab11

Hi,
I don't know if this is the right place to address my issue.
I am using you package on VS in a vb.net application. I've tried to do what you did in here:

https://trycatch.me/combinatorics-in-net-part-i-permutations-combinations-variations/

When it comes to send the combination to a MsgBox, I get errors. I am trying this:

Dim np As New List(Of Integer)

        For i = 0 To 5

            np.Add(i)

        Next

        Dim q As New Combinations(Of Integer)(np, 3)

        For Each v As Integer In q

            MsgBox(String.Join(",", v))

        Next

To mimic what you did there, but it's not working.

I have also tried:

Dim str As String = String.Join(",", q)

MsgBox(str)

But the result is just a sequence of "System.Collections.Generic.List`1[System.Int32]". They are in the number of q.count.

The list of combinations I get is an IReadOnlyList(Of Integer), the program doesn't let me do anything except q.count, so far.

The final aim is to work with the elements of the combinations to mime nested loops, so I need to convert, somehow, the combinations into a matrix (number of combinations, number of elements in each combination), or similar. The MsgBox in the example is just to try and see what happens, but nothing happens unfortunately.

I am really sorry if this is a stupid question, I am not an expert.

Thanks for you time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions