Dim player1Cards As New List(Of Card) Dim player2Cards As New List(Of Card) Dim player3Cards As New List(Of Card) Dim player4Cards As New List(Of Card)
For i As Integer = 0 To cards.Count - 1 Select Case i Mod 4 Case 0 player1Cards.Add(cards(i)) Case 1 player2Cards.Add(cards(i)) Case 2 player3Cards.Add(cards(i)) Case 3 player4Cards.Add(cards(i)) End Select Next
Public Class Form1 Dim cards As New List(Of Card) Dim player1Cards As New List(Of Card) Dim player2Cards As New List(Of Card) Dim player3Cards As New List(Of Card) Dim player4Cards As New List(Of Card) Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load For i As Integer = 1 To 13 cards.Add(New Card With {.Mark = "スペード", .Number = i}) cards.Add(New Card With {.Mark = "ダイヤ", .Number = i}) cards.Add(New Card With {.Mark = "クラブ", .Number = i}) cards.Add(New Card With {.Mark = "ハート", .Number = i}) Next cards.Add(New Card With {.Mark = "ババ"}) For i As Integer = 0 To cards.Count - 1 Select Case i Mod 4 Case 0 player1Cards.Add(cards(i)) Case 1 player2Cards.Add(cards(i)) Case 2 player3Cards.Add(cards(i)) Case 3 player4Cards.Add(cards(i)) End Select Next End Sub End Class Public Class Card Public Property Mark As String Public Property Number As Integer End Class