Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim lineItem = New With {.Name = myFile(index).Last_Name & ", " & myFile(index).First_Name, _
- .StartDate = myFile(index).Day,
- .EndDate = myFile(index).Day}
- Public Function CreateListFromSingle(Of T)(ByVal p1 As T) As List(Of T)
- Dim list As New List(Of T)
- list.Add(p1)
- return List
- End Function
- Dim list = CreateListFromSingle(dsResource)
- Public Function CreateEmptyList(Of T)(ByVal unused As T) As List(Of T)
- Return New List(Of T)()
- End Function
- Dim x = CreateEmptyList(New With { .Name = String.Empty, .ID = 42 })
- Module Module1
- Sub Main()
- Dim dsResource = New With {.Name = "Foo"}
- Dim List = dsResource.CreateTypedList
- End Sub
- <System.Runtime.CompilerServices.Extension()> _
- Function CreateTypedList(Of T)(ByVal Prototype As T) As List(Of T)
- Return New List(Of T)()
- End Function
- End Module
- Sub Main()
- Dim x = New With {.Name = "Bob", .Number = 8675309}
- Dim xList = {x}.ToList()
- End Sub
- Dim yourList = {(New With {.Name="", .Age=0})}.Take(0).ToList
- Public Function EnumerateFromSingle(Of T)(ByVal p1 As T) As IEnumerable(Of T)
- Return New T() { p1 }
- End Function
- Dim l = dsResources.Select(Function(d) New With {
- .Name = d.Last_Name & ", " & d.First_Name
- }).ToList()
- Dim aList = {(New With {.Name="John", .Age=30}),(.Name="Julie", .Age=32)}.ToList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement