Skip to content

[🚀 Feature]: [dotnet] [bidi] Don't use nested DTO types (!) #15407

Closed
@nvborisenko

Description

@nvborisenko

Feature and motivation

This is a continuation of #14530 point 1: "Discriminated unions". I proposed and implemented Local.Css nested type instead of CssLocator type. My last comment in that already resolved issue was:

I feel new CssLocator("div"); is better, we can make it before v5 if we have strong arguments (types discovery is a good argument).

I was wrong, and now I come with arguments. Actually only one argument. Nested type reserves its name in the parent. Which means we cannot add more members with the same name.

Use cases:

  • Static factory: when Selenium Team will have capacity to add more useful methods like Locator.Css("div") it will not be possible, because Css is already defined in Locator class.
  • Static singleton: In Script module we have LocalValue.Null class. This is great candidate to be singleton. But we cannot do it because Null name is already reserved by nested type.

Usage example

Before:

new Locator.Css("div");

After:

new CssLocator("div");

And all types with similar pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions