how to convert a List<int> to IEnumerable<int>

Last post 07-01-2009 8:50 PM by SGWellens. 1 replies.

Sort Posts:

  • how to convert a List<int> to IEnumerable<int>

    07-01-2009, 6:21 PM
    • Member
      11 point Member
    • kchaitanya
    • Member since 04-15-2009, 3:25 AM
    • Posts 23

    hi

    how to convert  a List<int>  to  IEnumerable<int>

    i got a list of ints i want to convert them into IEnumerable<int> in order to pass it to a method

    thanks

  • Re: how to convert a List<int> to IEnumerable<int>

    07-01-2009, 8:50 PM
    Answer
    • All-Star
      90,837 point All-Star
    • SGWellens
    • Member since 01-02-2007, 9:27 PM
    • Twin Cities, MN
    • Posts 7,413
    • Moderator
      TrustedFriends-MVPs

    It already is an IEnumberable:

     

            List<int> MyList = new List<int>();

            if (MyList is IEnumerable<int>)
                Response.Write("MyList is an IEnumerable list of ints ");

    Steve Wellens

    My blog
Page 1 of 1 (2 items)