Home > other >  No overload for method 'Join' takes 1 arguments
No overload for method 'Join' takes 1 arguments

Time:10-07

What he wants me to do here for Join can you help me solve the problem?

  public Dictionary<int, string> GetNonSecureDomainsSubUrls(int[] domainIds)
    {
        var data = UnitOfWork.NonSecureSession.SubDomainUrls
            .Where(x => x.IsActive && !x.IsDeleted && domainIds.Contains(x.DomainId))
            .ToList();

        var result = data.GroupBy(x => x.DomainId)
            .ToDictionary(x => x.Key, x => x.Select(a => a.UrlPrefix).Join(";"));

        return result;
    }

enter image description here

CodePudding user response:

I think you want the static string.Join method instead:

.ToDictionary(x => x.Key, x => string.Join(";", x.Select(a => a.UrlPrefix)))

CodePudding user response:

Your method signature suggests you need to use string.Join:

var result = data
   .GroupBy(x => x.DomainId)
   .ToDictionary(x => x.Key, x => string.Join(";", x.Select(a => a.UrlPrefix)));
  • Related