D
Davej
Ok, so how do you pass an array of anonymous thingies ?
var qtySorted =
from e in Inventory
orderby e.Quantity
select new {PartDesc = e.PartDescription, e.Quantity} ;
displayAIOEArray(ref qtySorted);
/* this will not compile
Error Argument: cannot convert from 'ref
System.Collections.Generic.IEnumerable<AnonymousType#1>' to 'ref
System.Linq.IOrderedEnumerable<Invoice>'
*/
private static void displayAIOEArray(ref IOrderedEnumerable<Invoice>
array)
{
if ( array.Any() )
{
foreach (var element in array)
Console.Out.WriteLine("{0}", element); //uses
class tostring override
}
else
{
Console.Out.WriteLine("No Results in array.");
}
}
var qtySorted =
from e in Inventory
orderby e.Quantity
select new {PartDesc = e.PartDescription, e.Quantity} ;
displayAIOEArray(ref qtySorted);
/* this will not compile
Error Argument: cannot convert from 'ref
System.Collections.Generic.IEnumerable<AnonymousType#1>' to 'ref
System.Linq.IOrderedEnumerable<Invoice>'
*/
private static void displayAIOEArray(ref IOrderedEnumerable<Invoice>
array)
{
if ( array.Any() )
{
foreach (var element in array)
Console.Out.WriteLine("{0}", element); //uses
class tostring override
}
else
{
Console.Out.WriteLine("No Results in array.");
}
}