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

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

Merged
merged 3 commits into from
Mar 3, 2023

Conversation

mandel-macaque
Copy link
Member

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

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
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
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants