- VB.NET質問スレ(Part43) [無断転載禁止]©2ch.net
659 :デフォルトの名無しさん[]:2017/08/12(土) 11:40:48.61 ID:QjNv8My6 - dictionary ( of integer, string) のofってなんですか?
| - VB.NET質問スレ(Part43) [無断転載禁止]©2ch.net
664 :デフォルトの名無しさん[]:2017/08/12(土) 20:14:41.43 ID:QjNv8My6 - 前の引数だけOFが付いてるのは何故なんだろう?
| - VB.NET質問スレ(Part43) [無断転載禁止]©2ch.net
665 :デフォルトの名無しさん[]:2017/08/12(土) 20:37:36.82 ID:QjNv8My6 - >660
良い資料ありがとう。意味わかりました。ofは両方の引数にかかるんだ。
| - VB.NET質問スレ(Part43) [無断転載禁止]©2ch.net
667 :デフォルトの名無しさん[]:2017/08/12(土) 22:39:38.37 ID:QjNv8My6 - Using the Of Keyword
The following code example uses the Of keyword to define the outline of a class that takes two type parameters. It constrains the keyType parameter by the IComparable interface, which means the consuming code must supply a type argument that implements IComparable. This is necessary so that the add procedure can call the System. IComparable.CompareTo method. For more information on constraints, see Type List. Ofキーワードの使い方について 次のコード例はOfキーワードを使っているが、それは二つのタイプのパラメータを取るクラスの外形を定義している。 IComparableインターフェースのKeyTypeパラメータを含むが、ここで使われるコードにはIComparableを実装した引数を あてなくてはならないということを意味する。これが必要なのはadd関数がシステムをコールのIComarable.CompareToを実行 できるようにするためである。さらに詳しくはListの項目を見ること Public Class Dictionary(Of entryType, keyType As IComparable) Public Sub add(ByVal e As entryType, ByVal k As keyType) Dim dk As keyType If k.CompareTo(dk) = 0 Then End If End Sub Public Function find(ByVal k As keyType) As entryType End Function End Class
|
|