Problems compiling a lambda expression



I've got a hint from a gentleman here to use the
following syntax.

public static FileInfo[]
GetFilesRegExp(this DirectoryInfo di, string pat)
{
Regex re = new Regex(pat);
return Array.FindAll(
di.GetFiles(),
(f) => re.IsMatch(f.Name));
}

The problem is that the compiler seems to dislike
"this" in the argument list as well as "goes to"
in the lambda expression.

What's up with that and how do i kill it?

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.


.



Relevant Pages

  • Re: [MSH] File oriented cmdlets need to accept FileSystemInfo or FileInfo objects
    ... taking FileSystemInfo, FileInfo, and DirectoryInfo. ... actually takes MshPaths not file system paths, ... We call this a delay-bind ScriptBlock. ...
    (microsoft.public.windows.server.scripting)
  • Re: Get File Size Using FileSystemInfo
    ... If an item in the ListBox happens to be a directory, ... The easiest way to recognize if a FileSystemInfo is a FileInfo or a DirectoryInfo is to use the "Is" keyword. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Problem creating FileInfo Array
    ... FileInfo[] fi; ... DirectoryInfo[] di = dirInfo.GetDirectories; ... > I've the following file system: ... > my desire is to create an array of fileinfo containing the a.jpg, ...
    (microsoft.public.dotnet.csharp.general)
  • Re: File & FileInfo
    ... Many many thanks, Laurent, for highlighting the differences. ... I mean that suppose you instantiate the FileInfo ... object on the second line of a sub-routine & use it, say, on the fifth ... and DirectoryInfo. ...
    (microsoft.public.dotnet.framework.aspnet)