using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace DeligateTests.GenericDelegate
{
class GenericDelegateTest : IProgramTest
{
public string Name
{
get { return "Test Func method"; }
}
public string Description
{
get { return Name; }
}
public void Run()
{
var result = Directory.GetFiles(Environment.CurrentDirectory).Select(s => new { Value = s, Length = s.Length });
var res = GetProjections(new DirectoryInfo(Environment.CurrentDirectory).GetFileSystemInfos(), f => new { FullName = f.FullName, Extension = f.Extension });
}
IEnumerableGetProjections (IEnumerable en, Func selector)
{
var list = new List();
foreach (var obj in en)
{
list.Add(selector(obj));
}
return list.AsEnumerable();
}
}
}
Saturday, September 18, 2010
The Built-In Generic Delegate Declarations
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment