0

I've seen a lot of posts here about String.Concat usage failing; EF documentation says it does support concat, but only the following three overloads:

System.String Concat(String str0, String str1)
System.String Concat(String str0, String str1, String str2)
System.String Concat(String str0, String str1, String str2, String str03)

The problem I'm having is that VB LINQ is defaulting to using the

System.String Concat(ParamArray values As String()) 

overload by default, so I get an error. Is there a way to force which overload I want within the EF query in VB? My query I use is the following:

from x in table
group join y ...
.
.
select New With { .Text = String.Concat(SqlFunctions.Convert(x.ID), " - ", if (y is null, "", y.Name)) }

Even using a select of:

select New With { .Text = String.Concat(SqlFunctions.Convert(x.ID), " - ", "TEST NAME") }

Fails too, because it uses the array overload, and not the argument overload. Is there a way to make it work?

2
  • It's usually dictated by the parameters, not sure why it's being forced to use the open parameter array one. Commented Sep 18, 2013 at 14:49
  • If I also use String.Concat("A", "B", "C") it also fails, saying it used the paramarray version, even though the VS designer shows the version with 3 string args that's listed above... Commented Sep 18, 2013 at 14:54

1 Answer 1

2

You could try using named parameters

select New With { .Text = String.Concat(str0:=SqlFunctions.Convert(x.ID), str1:=" - ", str2:="TEST NAME") }
Sign up to request clarification or add additional context in comments.

Comments

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.