Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support C# 12 collection expressions #964

Closed
meenzen opened this issue Sep 26, 2023 · 0 comments · Fixed by #966
Closed

Support C# 12 collection expressions #964

meenzen opened this issue Sep 26, 2023 · 0 comments · Fixed by #966
Labels
area:formatting type:bug Something isn't working
Milestone

Comments

@meenzen
Copy link
Contributor

meenzen commented Sep 26, 2023

C# 12 Collection expressions can't be formatted yet.

Example:

public class FooBar
{
    public void Foo()
    {
        List<string> list = ["Foo", "Bar"];
        Print(list);
    }

    public void Bar()
    {
        string[] array = ["Foo", "Bar"];
        Print(array);
    }

    private static void Print(IEnumerable<string> strings)
    {
        foreach (string str in strings)
        {
            Console.WriteLine(str);
        }
    }
}

Errors:

FooBar.cs - Failed to compile so was not formatted.
  (5,29): error CS1525: Invalid expression term '['
  (11,26): error CS1525: Invalid expression term '['

rel: #883

@belav belav added type:bug Something isn't working area:formatting labels Sep 26, 2023
@belav belav added this to the 0.26.0 milestone Sep 26, 2023
belav added a commit that referenced this issue Sep 29, 2023
shocklateboy92 added a commit that referenced this issue Oct 3, 2023
* Support for c# 12 collection expressions

closes #964

* bump up sdk version

---------

Co-authored-by: Lasath Fernando <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:formatting type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants