troubleshooting Question

Pull a list of string out of a list of generic properties

Avatar of kmccollum
kmccollumFlag for United States of America asked on
.NET ProgrammingVisual Basic.NET
2 Comments2 Solutions314 ViewsLast Modified:
I have a list of custom properties, in that list is a string value (exe: name). I would list to pull the string value (name) into a new list of string. I know that I can loop through each object and pull the value into a new list but I am looking for a shorter way.

Thanks


code example:
Is there a better way to do this
-----------------------------------
   Dim nList as New List(of String)
   For each o as object in oList
        nList.add(o.FirstName)
   Next
-----------------------------------

    Public Property BedNumber() As String
        <DebuggerStepThrough()> Get
            Return _bedNumber
        End Get
        Set(ByVal value As String)
            _bedNumber = value
        End Set
    End Property

    Public Property FirstName() As String
        <DebuggerStepThrough()> Get
            Return _firstName
        End Get
        Set(ByVal value As String)
            _firstName = value
        End Set
    End Property

    Public Property LastInt() As String
        <DebuggerStepThrough()> Get
            Return _lastInt
        End Get
        Set(ByVal value As String)
            _lastInt = value
        End Set
    End Property

    Public Property Gender() As String
        <DebuggerStepThrough()> Get
            Return _gender
        End Get
        Set(ByVal value As String)
            _gender = value
        End Set
    End Property
ASKER CERTIFIED SOLUTION
Triskelion

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros