Re: Problems compiling a lambda expression
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Sat, 26 Jul 2008 10:42:18 -0700
On Sat, 26 Jul 2008 10:39:17 -0700, K Viltersten <tmp1@xxxxxxxxxxxxxx> wrote:
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?
What errors are you getting _exactly_. Writing "the compiler seems to dislike" doesn't explain your problem at all.
As far as the "this", I expect that either you're not using C# 3.0 or you're trying to declare the method in a non-static class. But without knowing the error, it's hard to say for sure which or whether either is correct.
I don't see anything obviously wrong with the lambda expression, but again...if you're not using C# 3.0, then it wouldn't work.
Knowing the actual error message would help a _lot_. Frankly, that's always going to be true if you are asking about help with errors that occur, either during compilation or execution.
Pete
.
- Follow-Ups:
- Re: Problems compiling a lambda expression
- From: K Viltersten
- Re: Problems compiling a lambda expression
- References:
- Problems compiling a lambda expression
- From: K Viltersten
- Problems compiling a lambda expression
- Prev by Date: Problems compiling a lambda expression
- Next by Date: Re: Interop SendMessage : How to pass Structure to be filled by SendMessage
- Previous by thread: Problems compiling a lambda expression
- Next by thread: Re: Problems compiling a lambda expression
- Index(es):
Relevant Pages
|