Skip to content

Add ElementReference.IsEmpty or IsInitialized #61663

Open
@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


When working with Blazor Components, it would be nice if there was a way to tell if an ElementReference has been set.

Since you can't test an ElementReference for null, it would be nice if there was way to indicate if this is set before you refer to it. There must be something you can set in the struct to make it default to IsEmpty equals true then when set IsEmpty becomes false. Or set IsInitialized to true if the element exists.

To me this would make things simpler to work with and a little safer.

Thanks


Original Comments

Feedback Bot on 2/12/2025, 08:45 AM:

Thank you for taking the time to provide your suggestion. We will do some preliminary checks to make sure we can proceed further. You will hear from us in about a week on our next steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Author: Migration Bot 🤖The issue was created by a issue mover bot. The author may not be the actual author.area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions