David Ortinau on .NET MAUI

David Ortinau, Program Manager .NET and voice of .NET MAUI discusses MAUI as a platform, Blazor Hybrid, Community Toolkits, as well as what’s on the road map for .NET MAUI.

Posted in .NET MAUI, Blazor Hybrid, Microsoft, Podcast, Programming | Tagged | Leave a comment

Bill Wagner on C# 11 – Part 1

Bill Wagner creates C# learning and reference materials for https://learn.microsoft.com. He works with colleagues on the C# team, related content teams, and customers to provide resources for everyone that wants to learn more about C#. He’s also a member of the ECMA C# Standardization committee, working to update the C# standard.

I asked Bill, to come talk about C# 11 and to do so from the perspective of a programmer who stopped following the newest additions to C# as of C# 7 or 8 or so. That is, how do we catch up if we’ve fallen behind on the latest features?

This is part one, in which we discuss, among other things, Pattern Matching.

Here is a link to the tutorial Bill describes.

And here is a link to the top of the C# documentation.

Posted in C# 11, Essentials | Tagged | Leave a comment

Mark Price on C# 11

Mark Price joined me to discuss C# 11 and his books, C# 11 and .NET 7 and Apps and Services with .NET 7. Both books are available in my tiny book store, listed under Favorite books for programmers.

Note: A gremlin got into the original audio; fixed now. I apologize for the inconvenience.

Posted in C# 11, Podcast | Tagged , | Leave a comment

.NET MAUI – Forget Me Not – 7 – Unit Testing

Picking up where we left off, I want to add unit tests to my program. Now, I know, I should have been using unit tests all along. I have no excuse and hang my head in shame.

To get started, I’ve decided to add xUnit through NuGet. Easy peasy. But it won’t work. The full explanation is here. Great article. Here, in a nutshell are the steps you need to perform:

  1. Create an xUnit test project in the same solution as ForgetMeNot
  2. Make sure it runs
  3. Add a reference to the ForgetMeNot project
  4. This wil not run yet. Here is where the fun begins
  5. First, open up the ForgetMeNot project and change the TargetFrameworks to
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>

6. Replace the output statement with

<OutputType Condition="'$(TargetFramework)' != 'net6.0'">Exe</OutputType>

7. Unload ForgetMeNot, reload it, close Visual Studio, open Visual Studio and voila! it will work

(The whys and wherefores are explained very well in the article referenced above)

NSubstitute for mocking

Continue reading
Posted in .NET MAUI, Essentials, Testing | Tagged | Leave a comment

.NET MAUI Forget Me Not – Part 6.5

I have posted the (incomplete) code at https://github.com/jesseliberty/GraniteStateForgetMeNot and a video of much of the material captured in this series is now on YouTube

Posted in .NET MAUI, Mini-Tutorial | Tagged , , | 1 Comment

Newsletter about my novel

I’ve started a newsletter where I am publishing the first chapter of my novel, one sentence per day. This is not a techie novel, but check it out anyway. More at my fiction web site.

Posted in Non-technical | Tagged , | Leave a comment

Mads Torgersen & Dustin Campbell Part 2

Part 2 of my discussion with Mads and Dustin on what’s new in C# 11 with a focus on when application developers will use the new features.

Posted in C#, Essentials | Tagged , , | Leave a comment

Favorite Fiction

I’ve started a tiny bookstore of my favorite books.

Posted in Essentials | Comments Off on Favorite Fiction

C# 11 with Mads Torgersen & Dustin Campbell Part 1

Joined today by Mads and Dustin to discuss what’s new in C# 11 with a focus on when application developers will use the new features.

The funny thing about this image that I took back in 2019 is
that the person he is talking to (cropped out) is Dustin!
Posted in Essentials | Tagged , | Leave a comment

.NET MAUI – Forget Me Not – Part 6

Building on the previous postings, today I want to discuss the magic of Dependency Injection (DI)

Dependency Injection makes for cleaner and more testable code. We’ll get into testing and Mocks in a later blog post, but using DI allows you to substitute a mock service for a real one. In any case, it is magical.

Even though this is powerful, this posting will be short, because once you know how to do it, it is very easy.

Let’s look at BuddyPreferences. This is the page that lists all the preferences of a specific buddy. We start, in BuddyPreferences.xaml.cs by creating BuddyPreferencesViewModel so that it can be our BindingContext. We pass the ViewModel into the constructor. Here is the complete class:

public partial class BuddyPreferences : ContentPage
{
    private BuddyPreferencesViewModel vm;
    public BuddyPreferences(BuddyPreferencesViewModel vm)
    {
       this.vm = vm;
       BindingContext = vm;
       InitializeComponent();
    }

}
Continue reading
Posted in Essentials | Tagged , , | Leave a comment

.NET MAUI – Forget Me Not – Part 5

Building on the previous blog posts, here I’d like to illustrate how you can pass complex data from one page’s view model to another’s.

Let’s assume we’ve tapped on the Buddies Icon on the tab bar and were taken to the BuddyList:

If we tap on one of our buddies, in this case, Rodrigo, we should be taken to the details page for that buddy. We could pass along the buddy’s id, or we can pass the buddy object itself.

Continue reading
Posted in Essentials | Tagged , , | Leave a comment

.NET MAUI – Forget Me Not – Part 4

This is part 4 in an ongoing series in which I will build and dissect a non-trivial app. For details, please see the first in this series.

Part 3 ended with a teaser about the Preferences Page. As you’ll remember, we start with the Preference Model class:

namespace ForgetMeNot.Model;

[ObservableObject]
public partial class Preference
{
    [ObservableProperty] private string preferencePrompt;
    [ObservableProperty] private string preferenceValue;

}

I explained about ObservableProperties, so I won’t review that here. Let’s see how this model class is used. There are two important related classes: Preferences.xaml and PreferencesViewModel.cs

Continue reading
Posted in Essentials | Leave a comment