2

I was trying to test an extension method that I made for IEnumerable<T> inside of the C# Interactive Window that comes with VS2015 and I am having a hard time getting the window to find the method that I defined.

Basically I defined a method as follows:

public static IEnumerable<T> AsEndless<T>(this Enumerable<T> currEnum)

If I create a new console project and reference my extensions project I can call that extension method just fine, but if I try to do the same thing in the C# interactive window, even after importing the dll with #r 'path-to-dll' I get an error saying that my test List<int> does not contain a definition for 'AsEndless'.

Is it simply not possible to do something like this with the C# Interactive Window?

1
  • Extension methods are translated by the compiler to static method calls, which the immediate window apparently doesn't support. You may be relegated to calling the static method directly versus calling it as an extension method. Commented Mar 7, 2016 at 16:19

1 Answer 1

2

It's possible you forgot to do the using too from within the interactive window.

Sign up to request clarification or add additional context in comments.

2 Comments

You know what, that was exactly it >.>
Thought it would be, this caught me out too. I'm hoping they might make the interactive window more seamlessly interact with the current open solution etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.