تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[كود] Concatenate List(Of T) with Func Delegate
#1
الكود التالي يوضح كيف نضيف مصفوفة إلي مصفوفة أخري

PHP كود :
  Public Function ConcatenateList(Of T)(first As List(Of T), second As List(Of T)) As T()

 
       Dim concatenate As Func(Of List(Of T), List(Of T), T()) = Function(As List(Of T), As List(Of T))
 
                                                                     Dim result As T() = New T(X.Count Y.Count 1) {}
 
                                                                     For i As Integer 0 To X.Count 1
                                                                          result
(i) = X(i)
 
                                                                     Next
                                                                      For j 
As Integer 0 To Y.Count 1
                                                                          result
(X.Count j) = Y(j)
 
                                                                     Next
                                                                      Return result
                                                                  End 
Function
 
       Return concatenate(firstsecond)
 
   End Function 

الإستخدام

PHP كود :
       ' Use it as string list
        Dim l1 As List(Of String) = New List(Of String) From {"Omar", "Amr"}
        Dim l2 As List(Of String) = New List(Of String) From {"Sherief", "Ahmed", "Omar"}

        ' 
do something with the array
 
       Dim l3 As String() = ConcatenateList(Of String)(l1l2)
 
       ListBox1.Items.AddRange(l3)

 
       ' ---------------------------------------------------

        ' 
Use it as integer list
 
       Dim int1 As List(Of Integer) = New List(Of IntegerFrom {102030}
 
       Dim int2 As List(Of Integer) = New List(Of IntegerFrom {405060}
 
       Dim int3 As Integer() = ConcatenateList(Of Integer)(int1int2)

 
       ' do something with the array
        For Each i As Integer In int3
            ListBox2.Items.Add(i)
        Next 
الرد }}}


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
  [مقال] Generic Delegates - Func and Action silverlight 16 8,284 30-12-19, 07:59 AM
آخر رد: myegy
  Delegate Function silverlight 6 2,973 30-10-17, 04:27 PM
آخر رد: alsouf
  Convert Delegate to IntPtr & Viceversa silverlight 1 1,678 15-08-17, 04:54 PM
آخر رد: silverlight
  معلومة- dim X as new list(of T) RaggiTech 2 2,211 05-10-12, 03:04 AM
آخر رد: RaggiTech
  التعامل مع Resources و image list الاستغناء عن المسارات RaggiTech 1 3,248 02-10-12, 10:58 AM
آخر رد: RaggiTech

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم