Skip to content

Can't use System.Linq Queryable extension methods #198

@tonnydourado

Description

@tonnydourado

Trying to use IEnumerable.AsQueryable causes a compilation error, even after adding @using System.Linq.

Reproduction:

  • Snippet: https://try.mudblazor.com/snippet/wYmKEnGwLAhKlUnI
  • Code:
    @using System.Linq 
    <MudText Typo="Typo.h6">MudBlazor is @Text</MudText>
    <MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="ButtonOnClick">@ButtonText</MudButton>
     
    @code {
        public string Text { get; set; } = "????";
        public string ButtonText { get; set; } = "Click Me";
        public int ButtonClicked { get; set; }
     
        void ButtonOnClick()
        {
            IEnumerable<string> data = new List<string>() { "a", "b", "c" };
            data = data.Select(x => x.ToUpper()).ToArray(); // This works
            data = data.AsQueryable().Select(x => x.ToUpper()).ToArray(); // this doesn't
            ButtonClicked += 1;
            Text = $"Awesome x {ButtonClicked} ({string.Join(",", data)})";
            ButtonText = "Click Me Again";
        }
    }
  • Expected: Adding @using System.Linq should fix the compilation error
  • What actually happens: It doesn't.
  • Browser: Firefox 148.0.2 (64-bit), on windows, normal mode (not incognito/private)
  • DotNET version: 10.0.3
  • MudBlazor version: v9.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions