convertall

Method chaining generic list extensions

I have a List of a "complex" type - an object with a few string properties. The List itself is a property of another object and contains objects of a variety of types, as shown in this abbreviated class structure: Customer { public List<Characteristic> Characteristics; . . . } Characteristic { public string Characterist...

C# - generic List and ConvertAll() Method, how does it internally work?

Hello, from some code I found in Sacha Barbers free mvvm framework chinch I saw this: return new DispatcherNotifiedObservableCollection<OrderModel>( DataAccess.DataService.FetchAllOrders( CurrentCustomer.CustomerId.DataValue).ConvertAll( new Converter<Order, OrderM...

Converting a list of ints to a byte array

I tried to use the List.ConvertAll method and failed. What I am trying to do is convert a List to byte[] I copped out and went this route but I need to figure out the ConvertAll method... List<Int32> integers... internal byte[] GetBytes() { List<byte> bytes = new List<byte>(integers.Count * sizeof(byte)); ...

why does C# convertall require 2 parameters

I have an array of Car objects I want to conver them to a list of Vehicle objects I thought this would work Vehicle[] vehicles = cars.ConvertAll(car=> ConvertToVehicle(car)).ToArray(); but its complaining that ConvertAll requires two parameters. here is the error: Error 2 Using the generic method 'System.Array.ConvertAll(TInput[...