My site says we just crossed 144,000 users. I’m stunned.
Turn the tables: 2016
API – Functions Part 3: Routing
In the previous part of this series, we looked at creating our first API. But how do you determine which API is being invoked? This is accomplished with routing.
If you have a Products class your entry (end point) might look like this:
[Function(nameof(Products))] public IActionResult Run(HttpTrigger(AuthorizationLevel.Anonymous, "get", Route="products/{category}/{id: int}")] HttpRequest req, string category, int id) { return new OkObjectResult(new {category, id}); }
Notice the routing property (“products/{category}/{id: int}” — this allows us to customize and restrict the arguments from the desired endpoint. The customer/user can now use the same endpoint for a variety of situations.
API Part 2 – Creating your first API
This is part 2 in our series on .NET APIs with C#. Find Part 1 here.
No surprise, the first step in building your application is to create a new solution. To get started, choose the Azure Functions template.
- Name your function, choose a location and click Next
- Select your runtime and hosting. Generally speaking, choose the latest LTS (Long Term Support) option
- Under authorization, choose Anonymous
- Under Function, select Http trigger
- Check Use Azurite (we’ll need this in a future post about durable functions)
- Click next and hey presto! your solution is created.
James Montemagno on blending .NET application development
A fascinating discussion of building .Net MAUI applications with Blazor and JavaScript libraries. James’ enthusiasm is catching and he doesn’t disappoint in this interview.
-
.NET Beginner Videos: https://dotnet.microsoft.com/
en-us/learn/videos -
Microsoft Learn Training: https://learn.microsoft.com/
en-us/training/dotnet/ -
Workshops: http://github.com/dotnet-
presentations -
.NET 10 – Next Page: https://dotnet.microsoft.com/
en-us/next -
YouTube: https://youtube.com/@
jamesmontemagno
Azure Functions – Part 1
This begins a short series on Azure Functions and Durable Functions from the perspective of building APIs. This is based on material from my book Programming APIs with C# and .NET that I wrote with Joseph Dluzen (to tell the truth, the Functions chapters were initially written by Joe!)
Understanding Functions – Don’t Panic
Azure Functions are very important when focusing on event-driven data processing. Functions allow for ease of development, deployment and scaling. Functions are considered to be serverless in that you don’t have to manage individual instances.
Mads K. on Visual Studio
Mads Kristensen discusses Visual Studio extensions, and the use of CoPilot to get the most out of Visual Studio programming.

Maddy Leger on Aspire
Maddy is the program manager/ owner of Microsoft’s Aspire. This is new, exciting and powerful.

Best of JesseLiberty.com: Bayesian Probability
This from 2009:
Yudkowsky poses the following canonical problem:
1% of women at age forty who participate in routine screening have breast cancer. 80% of women with breast cancer will get positive mammographies. 9.6% of women without breast cancer will also get positive mammographies.
A woman in this age group had a positive mammography in a routine screening. What is the probability that she actually has breast cancer?
The frightening thing is that only 15% of doctors get this right. And they’re off by a lot. That is, the average answer is in the range of 80% while the correct answer is 7.8%. Apparently, there is something about the way we think about the problem that makes 7.8% hard to accept, and Yudkowsky does a great job of walking you through the logic in painfully small steps.
Let’s try something similar here…
What Do We Know & What Does It Imply?
We have three pieces of information:
1% of sample are TRUE (that is, they have cancer)
80% of sample who are TRUE will test TRUE
9.6% of sample who are FALSE will test TRUE.
On the face of it, we should guess that the percentage of women who test TRUE who actually are TRUE (test positive and actually have cancer) is pretty small based on two facts provided: the actual percentage of women from the sample who are TRUE (regardless of testing) is only 1%, and the test has a false positive for 9.6% of those tested.
So, to solve this:
1) Assume we have a sample of 1000 women (I use 1000 to reduce the amount I have to talk about fractional people, but I don’t use 10,000 as I get lost in the zeros).
2) We know that the reality is that of the 1,000 women, 10 will have cancer (1%).
990 = no cancer
10 = cancer
3) Of the 10 who have cancer, 8 will test positive
8 out 1000 women tested will test True and are True
4) Of the 990 with no cancer 9.6% will also test positive = 990 * .096 = 95.04.
95.04 women out of 1,000 will test True but are False.
5) The total number testing true is 8 + 95.04 = 103.04.
Of these, 8 actually have Cancer.
6) So the value for tests positive (103.04) versus is positive (8) is 8/103.4 or 0.773 or 7.8%
Mastering C# – Pattern Matching
Microsoft has a wonderful tutorial on pattern matching, in which you model a lock (to raise or lower a ship when there would otherwise be a waterfall). They model the two doors and the water level.
While their example is excellent it is long, and in this blog post I’m going to take the essence of pattern matching using their example.
Continue readingModern C# Part 3 – Switch Expressions
I admit it, I’ve struggled with pattern matching. In the next few blog posts I’ll explore this magic, starting today with switch expressions (not to be confused with switch statements).
Continue readingModern C# Part 2 – Accessing via Implicit Index
Until now, if you wanted to access the last item in a list you had to use a slightly cumbersome syntax. C# 13 introduces the “hat” operator (^) where ^1 is the last element in your collection, ^2 is the penultimate member, etc.
Like many things, this is best illustrated with an example. In the following code I create a simple Person class and initialize a list<Person> with three people (persons?)
internal class Program
{
static void Main(string[] args)
{
var tester = new Tester();
tester.Test();
}
}
public class Tester()
{
public void Test()
{
var john = new Person { Name = "John", Age = 25 };
var jane = new Person { Name = "Jane", Age = 30 };
var joe = new Person { Name = "Joe", Age = 35 };
var people = new List<Person> { john, jane, joe };
}
}
public class Person()
{
public string Name { get; set; }
public int Age { get; set; }
}
Straight forward. Now, if I want to access the last person in this list I can write
var lastPerson = people[^1];
Console.WriteLine($"Last person is {lastPerson.Name} who is {lastPerson.Age} years old.");
As you can see, this is concise and easy to understand. You read it as “lastPerson is equal to one back from the end of people.” Let’s run it:
Last person is Joe who is 35 years old.
That is all there is to it. Easy to use and somewhat helpful in simplifying your code.