Hola
Bien gracias a nuestro querido amigo Elektro (que jaleti soy ) :silbar:
tengo este codigo o funcion que funciona bien.pero ahora se me ocurre que en ves de un solo digito con los que se combinan ahora lo quiero hacer de dos digitos .
Ahora es con estos
{0, 3, 4, 5, 8}
pero si pongo
{01, 13, 34, 55, 84}
No logro hacer lo mismo que con los digitos solos he modificado trasteado pero nada
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim valuesInt As IEnumerable(Of Integer) =
{0, 3, 4, 5, 8}
{01, 13, 34, 55, 84} <---------usar esto ????
Dim pairs As IEnumerable(Of KeyValuePair(Of Integer, IEnumerable(Of Integer))) =
Form1.GetPairs(valuesInt, maxValue:=90)
For Each pair As KeyValuePair(Of Integer, IEnumerable(Of Integer)) In pairs
' ListBox1.Items.Add(String.Format("Key: {0,-4} Values: {1}", pair.Key, String.Join(", ", pair.Value)))
Next pair
Public Shared Function GetPairs(ByVal col As IEnumerable(Of Integer),
Optional ByVal maxValue As Integer = Integer.MaxValue) As IEnumerable(Of KeyValuePair(Of Integer, IEnumerable(Of Integer)))
If (col.Max >= 10) Then
Throw New ArgumentException(paramName:="col", Message:="El valor máximo de la colección debe ser un valor inferior a 10.")
Else
Return From value As Integer In col
Select New KeyValuePair(Of Integer, IEnumerable(Of Integer))(
key:=value,
value:=From index As Integer In col
Where (index <> value) AndAlso (CInt(value & index) <= maxValue)
Select CInt(value & index))
End If
Luis