Question

Below is the basic setup of my program thus far. 2 classes. One to keep track of the OrderInfo and the other to do the WebRequest processes and gather the information.

I know that order.FullCashValues = Details.ToArray(); will put all the values of my Details List into the FullCashValues object[]. But i just want the first 6 items to go into that object and the rest of the objects in the Details list to go into the AssessedValues object[].

Any help?

    Public Class OrderInfo
    {
    public object[] FullCashValues {get;set;}
    public object[] AssessedValues {get;set;}
    }

Public Class WebRequests
{
    public static List<List<object>> Main_Process(OrderInfo order)
    {
    //returns a list of values taken from the url
    List<object> Details = DetailsPage(url1, ParcelNumber);

    //Details[0] through Details[5] should go into 
    //FullCashValues

    //Details[6] through Details[11] should go into
    //AssessedValues
    }
    }
Était-ce utile?

La solution

You can use LINQ's Skip and Take methods to split the list (both methods are available in .NET 3.5).

FullCashValues = Details.Take(6).ToArray();
AssessedValues = Details.Skip(6).ToArray();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top