Skip to content

UseNullPropagation single else statement #33

@marodev

Description

@marodev

Given

        static void L(string s, DynamicApi api)
        {
            if (s.Equals("2"))
            {
                
            } else if (api != null)
            {
                api.M();
            } 
        }

should be

        static void L(string s, DynamicApi api)
        {
            if (s.Equals("2"))
            {
                
            } else
            {
                api?.M();
            }
        }

Current behaviour

        static void L(string s, DynamicApi api)
        {
            if (s.Equals("2"))
            {
                
            } else api?.M();
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions