I'm trying to follow the instructions on Creating an IQueryable LINQ Provider, but when I implement the classes which inherit from ExpressionVisitor
as instructed I am told that ExpressionVisitor is inaccessible due to its protection level. Am I missing something incredibly basic?
Asked
Active
Viewed 1,685 times
4

tags2k
- 82,117
- 31
- 79
- 106
2 Answers
5
The class is sealed, stupidly enough. Use the ExpressionVisitor at the end of this post instead. I can definitely recommend that walk-through, btw, it's really comprehensive and helpful in every way.
Good luck!

Mia Clarke
- 8,134
- 3
- 49
- 62
-
Thanks! I'm on my way to IQueryable goodness, but why on earth did the MSDN article want me to inherit a class that I couldn't?! – tags2k Apr 14 '10 at 14:43
-
I honestly don't know, I faced the same idiocraticy when I was doing this about a year ago. Have fun building your provider! – Mia Clarke Apr 15 '10 at 09:09
-
What a brilliant set of tutorials - I'm on #4 and I've already got an awesome provider. I guess you just can't rely on Microsoft to produce good tutorials themselves! – tags2k Apr 16 '10 at 15:37
-
I fully agree, Matt rocks! What are you building a provider for, if I may ask? – Mia Clarke Apr 16 '10 at 20:08
-
3You probably already know this but just in case you don't, .NET 4.0 now exposes the MS implementation of ExpressionVisitor and have extended it somewhat. – Tim Jarvis Jul 09 '10 at 02:08
-
Sorry Banang, I must have missed your comment because I've just been redirected back here by the new answer. I was building and did indeed build a provider for my ORM, and it's pretty tasty now! :) – tags2k Jul 24 '11 at 15:51
-
1Useful to know. I am still supporting 3.5 codebases and I eventually came here because most examples were using the `ExpressionVisitor` class as it would be a valid base class. Good to know an alternative version exists. – Ivaylo Slavov May 08 '15 at 11:21
4
In .NET 4.0, the Microsoft-provided implementation of ExpressionVisitor
(built into the BCL) is no longer sealed.

David Pfeffer
- 38,869
- 30
- 127
- 202