With C# object initializers, you can project into more complex types.
class MyItem
{
public string item1;
public string item2;
}
and then project into it with object initializers:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class MyItem
{
public string item1;
public string item2;
}
class Program
{
static void Main()
{
string[] names = { "Java", "C#", "Javascript" };
IEnumerable temp =
from n in names
select new MyItem
{
item1 = n,
item2 = n.Replace("a", "").Replace("e", "").Replace("i", "")
.Replace("o", "").Replace("u", "")
};
foreach(MyItem item in temp){
Console.WriteLine(item.item1);
Console.WriteLine(item.item2);
}
}
}
The output:
Java
Jv
C#
C#
Javascript
Jvscrpt