小编Sim*_*cha的帖子

Roslyn CompletionService 不返回静态扩展方法

如果using System.Linq;存在并且System.Linq位于引用的程序集中,我希望 an 上的int[] array完成返回 LINQ 扩展方法,例如Select<>(...)Where<>(...)等。事实上,我只获取该int[]类型的公共方法和属性。这是完整的代码:

static void Main(string[] args)
    {
        string code = @"using System;
        using System.Linq;

       namespace RoslynCompletionTests
       {
             public static class MyTestClass1
             {
                   public static void Print()
                   {
                          int[] array = {1,2,3,4,5,6};

                          var result = array.Select(i => new { I = i }).Select(v => v.I);
                   }
             }
       }";
        var host = MefHostServices.Create(MefHostServices.DefaultAssemblies);
        
        Type[] types =
        {
            typeof(object),
            typeof(Enumerable),
            typeof(IEnumerable),
            typeof(Console),
            typeof(Assembly),
            typeof(List<>),
            typeof(Type)
        }; …
Run Code Online (Sandbox Code Playgroud)

c# roslyn

6
推荐指数
1
解决办法
286
查看次数

标签 统计

c# ×1

roslyn ×1