This code sample will allow one to separate values of specific types using LINQ
This example WORKS WITH ONLY VB.net 9.0(VS.net 2008)
Sub Main() Dim obj() As Object = {1, "Hefin", 100, "Initiotech", "Dsouza", True, False} Dim onlyIntegers = obj.OfType(Of Integer)() Dim OnlyString = obj.OfType(Of String)() Dim onlyBoolean = obj.OfType(Of Boolean)() Console.WriteLine("Only Integer's in The Object Array are : ") For Each i As Integer In onlyIntegers Console.WriteLine(i) Next
Console.WriteLine("Only String's in The Object Array are : ") For Each i As String In OnlyString Console.WriteLine(i) Next
Console.WriteLine("Only Boolean's in The Object Array are : ") For Each i As Boolean In onlyBoolean Console.WriteLine(i) Next
End Sub
Download Sample Application For More Information ================================================================================
AttachmentsDownload Linq Sample (20970-111116-DataTypeQuery.rar)
|
No responses found. Be the first to respond and make money from revenue sharing program.
|