たのしけりゃ〜いいの。

こんなの書いた。
さて、ICardインターフェイスはIDisposable でいいのかしら?


Option Explicit On
Option Strict On

Imports System
Imports System.Drawing

Namespace SilverBouquet.ToyBox


Public Interface ICard
Inherits IDisposable

Property ForeImage() As Image

Property BackImage() As Image

Property Tag() As Object

End Interface


End Namespace


Option Explicit On
Option Strict On

Imports System
Imports System.Drawing

Namespace SilverBouquet.ToyBox


Public MustInherit Class PlayingCard
Implements ICard


Private _backImage As Image

Public Property BackImage() As Image Implements ICard.BackImage
Get
Return Me._backImage
End Get
Set(ByVal value As Image)
Me._backImage = value
End Set
End Property


Private _foreImage As Image

Public Property ForeImage() As Image Implements ICard.ForeImage
Get
Return Me._foreImage
End Get
Set(ByVal value As Image)
Me._foreImage = value
End Set
End Property


Private _tag As Object

Public Property Tag() As Object Implements ICard.Tag
Get
Return Me._tag
End Get
Set(ByVal value As Object)
Me._tag = value
End Set
End Property


Private _disposed As Boolean = False

Public ReadOnly Property IsDisposed() As Boolean
Get
Return Me._disposed
End Get
End Property


Public Sub New()

End Sub


Protected Overridable Sub Dispose(ByVal disposing As Boolean)

If Me._disposed Then

Exit Sub

End If

If disposing Then

If Me.ForeImage IsNot Nothing Then

Me.ForeImage.Dispose()

End If

If Me.BackImage IsNot Nothing Then

Me.BackImage.Dispose()

End If

End If

Me._disposed = True

End Sub


Public Sub Dispose() Implements IDisposable.Dispose

Me.Dispose(True)
GC.SuppressFinalize(Me)

End Sub


End Class


EndNamespace

番号札と、ジョーカーはあるけど、長くなるので略。