Skip to content

[Windows] Add helper method to get GetFirstChildOfType with null support. - #13421

Merged
PureWeen merged 3 commits into
mainfrom
dev/mandel/helper-method-get-first-child-Type
Mar 3, 2023
Merged

PureWeen merged 3 commits into
mainfrom
dev/mandel/helper-method-get-first-child-Type

Conversation

@mandel-macaque

@mandel-macaque mandel-macaque commented Feb 17, 2023 •

Copy link
Copy Markdown
Contributor

Well make us move from code like this:

if (searchView.GetFirstChildOfType<EditText>() is EditText foo)
    foo.SetInputType(searchBar);
var foo = searchView.GetFirstChildOfType<EditText>();
if (foo is not null)
    foo.SetInputType(searchBar);

To a nicer:

if (searchView.TryGetFirstChildOfType<EditText>(out var foo)
    foo.SetInputType(searchBar);

mandel-macaque and others added 2 commits February 17, 2023 12:57
…ort.

Well make us move from code like this:
```csharp
var foo = searchView.GetFirstChildOfType<EditText>();
if (foo is not null)
    foo.SetInputType(searchBar);
```
To a nicer:
```csharp
if (searchView.TryGetFirstChildOfType<EditText>(out var foo)
    foo.SetInputType(searchBar);
``
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your pull request. We are auto-formating your source code to follow our code guidelines.

@jsuarezruiz
jsuarezruiz self-requested a review March 1, 2023 15:27
@jsuarezruiz
jsuarezruiz requested a review from PureWeen March 3, 2023 12:29
@PureWeen
PureWeen merged commit 7ed2a9a into main Mar 3, 2023
@PureWeen
PureWeen deleted the dev/mandel/helper-method-get-first-child-Type branch March 3, 2023 23:11
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 13, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants