Salve a tutti, sono nuovo nel forum! 
Ho sviluppato con innumerevli sforzi una classe in vb.net che mi permette di effettuare dell disposizioni con ripetizione (per chi non sapesse cosa sono "http://it.wikipedia.org/wiki/Calcolo_combinatorio").
Ecco il codice:
Imports System
Imports System.Collections
Imports System.Collections.Generic
Public Class Generator
Private a As String
Private n As Integer
Public Sub New(ByVal a As String, ByVal n As Integer)
Me.a = a
Me.n = n
End Sub
Public Function getVariations() As List(Of String)
Dim l As Integer = a.Length
Dim permutations As Integer = CInt(System.Math.Pow(l, n))
Dim table As Char()() = New Char(permutations - 1)() {}
For i As Integer = 0 To permutations - 1
table(i) = New Char(n - 1) {}
Next
For x As Integer = 0 To n - 1
Dim t2 As Integer = CInt(System.Math.Pow(l, x))
Dim p1 As Integer = 0
While p1 < permutations
For al As Integer = 0 To l - 1
For p2 As Integer = 0 To t2 - 1
table(p1)(x) = a(al)
p1 += 1
Next
Next
End While
Next
Dim result As New List(Of String)()
For Each permutation As Char() In table
result.Add(New String(permutation))
Next
Return result
End Function
End Class
Ora vorrei implementare una caratteristica particolare: se io volessi interrompere e riprendere la lista generata come potrei fare?
ad esempio se volessi generare le disposizioni di 4 lettere di "abc" ma interrompessi il programma a metà, come potrei in un secondo momento riprendere l'ultimo indice scritto (su un file di testo)? è fattibile?
Grazie mille per la pazienza
.
Federico
Ps: Com'è il codice, è scritto abbastanza bene?