C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Retriving specific DataType values from an object array


Posted Date: 11 Sep 2008    Resource Type: Code Snippets    Category: VB.NET Syntax

Posted By: Initiotech       Member Level: Gold
Rating:     Points: 7



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
================================================================================

Attachments

  • Download Linq Sample (20970-111116-DataTypeQuery.rar)



  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Separate values of specific types using LINQ  .  Separate values of specific types  .  Retriving specific DataType values from array of objects  .  Retriving specific DataType values  .  Linq DataType  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Linq To Display Only Even Numbers From an Array
    Previous Resource: Display the Available Database on Current Server
    Return to Discussion Resource Index
    Post New Resource
    Category: VB.NET Syntax


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers   BizTalk Adaptors    Web Design

    doors in nj

    Contact Us    Privacy Policy    Terms Of Use