Resolving ambiguous types with "using" doesn't work

edited August 2014
I have a class called Group in one of my DLLs. When I use it, I get
'Group' is an ambiguous reference between 'System.Text.RegularExpressions.Group' and MyApp.Group

When I try to add

using Group = MyApp.Group;

at the top of the file, Linqpad thinks I'm trying to add a namespace and gives a

Syntax error, '(' expected
) expected


error. What should I do to use MyApp.Group?

Comments

  • Press F4 for Query Properties. In additional namespace imports, put:

    Group = MyApp.Group
  • That worked. Thanks.
  • edited October 2016
    When i put in additional namespace imports the line
    MyType = Namespace1.MyType
    the error changes to "CS0236 A field initializer cannot reference the non-static field, method, or property 'Namespace2.MyType'".

    The type is an enum in Namespace1, and a table class in Namespace2.
  • edited October 2016
    And for a local variable definition, another error appears:
    "CS1061 'ObjectSet' does not contain a definition for 'MyMember' and no extension method 'MyType' accepting a first argument of type 'ObjectSet' could be found (press F4 to add a using directive or assembly reference)"
  • @AndreyK Sounds like a C# error probably nothing to do with the Linqpad "using" statement. I would suggest trying stack-overflow with the code for a better response.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!