Current Path : /www/sites/www.coderblog.in/index/
Url:

NameSizeOptions
App_DataDIRnone
backupDIRnone
cgi-binDIRnone
cssDIRnone
imgDIRnone
metaDIRnone
wp-adminDIRnone
wp-contentDIRnone
wp-includesDIRnone
.htaccess3.35 KBDEL
.htaccess.bk1.84 KBDEL
404.html0.13 KBDEL
ads.txt1.07 KBDEL
favicon.ico2.19 KBDEL
index.php0.40 KBDEL
license.txt19.44 KBDEL
php.ini0.58 KBDEL
readme.html7.25 KBDEL
service.php0.00 KBDEL
web.config2.87 KBDEL
wp-activate.php7.21 KBDEL
wp-blog-header.php1.21 KBDEL
wp-comments-post.php2.27 KBDEL
wp-config-sample.php3.26 KBDEL
wp-config.php2.98 KBDEL
wp-cron.php5.49 KBDEL
wp-links-opml.php2.44 KBDEL
wp-load.php3.84 KBDEL
wp-login.php50.21 KBDEL
wp-mail.php8.52 KBDEL
wp-settings.php29.38 KBDEL
wp-signup.php33.71 KBDEL
wp-trackback.php4.98 KBDEL
xmlrpc.php3.13 KBDEL
.Net – Coder Blog https://www.coderblog.in Join the coding revolution! Learn, share, and grow together! Sat, 22 Nov 2025 14:10:09 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.1 Goodbye Verbose Code: 5 Modern C# Features That Changed My Workflow https://www.coderblog.in/2025/11/goodbye-verbose-code-5-modern-c-features-that-changed-my-workflow/ https://www.coderblog.in/2025/11/goodbye-verbose-code-5-modern-c-features-that-changed-my-workflow/#comments Sat, 22 Nov 2025 14:10:06 +0000 https://www.coderblog.in/?p=1366 I’ve been writing C# for a long time. I remember the days of C# 2.0 and 3.0, where

<p>The post Goodbye Verbose Code: 5 Modern C# Features That Changed My Workflow first appeared on Coder Blog.</p>

]]>
I’ve been writing C# for a long time. I remember the days of C# 2.0 and 3.0, where explicit types were mandatory, asynchronous programming involved complex callback hell, and creating a simple data object required twenty lines of boilerplate code.

For years, C# (much like Java) had a reputation for being verbose. We spent more time typing structural boilerplate than actual business logic.

But things have changed. With the rapid release cadence of .NET Core (now just .NET) and C# versions 8 through 12, the language has transformed. It has become more expressive, functional, and concise.

As a senior developer, I don’t adopt new syntax just because it’s “shiny.” I adopt it if it reduces cognitive load and makes code easier to read. Here are the 5 modern C# features that have genuinely changed my daily workflow.

1. File-Scoped Namespaces (C# 10)

This might seem like a trivial cosmetic change, but it is the single most satisfying cleanup feature for me.

The Old Way: In the past, every file started with a namespace indentation tax. Your entire class was shifted four spaces to the right, wasting horizontal screen real estate.

namespace MyApp.Services
{
    public class UserService
    {
        public void DoSomething()
        {
            // Logic here...
        }
    }
}

The New Way: With File-Scoped Namespaces, you declare the namespace once at the top, end it with a semicolon, and remove the curly braces.

namespace MyApp.Services;

public class UserService
{
    public void DoSomething()
    {
        // Logic here...
    }
}

Why it changed my workflow: It removes an unnecessary level of nesting. When I open a file, the code is flush with the left margin. It looks cleaner, reads better on smaller laptop screens, and reduces the “pyramid of doom” effect when you have nested logic inside methods.

2. Records & Positional Syntax (C# 9)

I write a lot of DTOs (Data Transfer Objects) and API response models. In “Old C#,” creating an immutable object that supported value-based equality was a nightmare of boilerplate. You had to override EqualsGetHashCode, and create a constructor to set properties.

The Old Way:

public class CustomerDto
{
    public string Name { get; }
    public string Email { get; }

    public CustomerDto(string name, string email)
    {
        Name = name;
        Email = email;
    }

    // Imagine 20 more lines of Equals/GetHashCode overrides here...
}

The New Way: Enter record.

public record CustomerDto(string Name, string Email);

That’s it. That is the entire file.

Why it changed my workflow: This turns a 30-line file into a 1-line definition. It gives me immutability by default, value-based equality (great for unit testing comparisons), and a generic ToString() implementation out of the box. It has fundamentally sped up how I prototype and define domain models.

3. Global Usings (C# 10)

How many times have you typed (or let Visual Studio auto-generate) these lines?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

You do this in *every single file. It’s visual noise.

The New Way: You can now create a single file (often called GlobalUsings.cs) in your project root:

// GlobalUsings.cs
global using System;
global using System.Collections.Generic;
global using System.Linq;
global using Microsoft.EntityFrameworkCore;

Alternatively, you can enable “Implicit Usings” in your .csproj file, which handles the basics for you automatically.

Why it changed my workflow: My files now start directly with the code that matters. I only see using statements if they are specific to that file (like a specific Service or Utility). It drastically reduces the header clutter.

4. Switch Expressions (C# 8)

The traditional switch statement was clunky. It required casebreak, and return keywords scattered everywhere. It was easy to miss a break statement and cause a bug.

The Old Way:

public string GetStatusMessage(OrderStatus status)
{
    switch (status)
    {
        case OrderStatus.Pending:
            return "Please wait.";
        case OrderStatus.Shipped:
            return "On the way!";
        case OrderStatus.Delivered:
            return "Enjoy your item.";
        default:
            throw new ArgumentException("Unknown status");
    }
}

The New Way: Switch expressions utilize pattern matching to turn this into a functional-style expression.

public string GetStatusMessage(OrderStatus status) => status switch
{
    OrderStatus.Pending   => "Please wait.",
    OrderStatus.Shipped   => "On the way!",
    OrderStatus.Delivered => "Enjoy your item.",
    _                     => throw new ArgumentException("Unknown status")
};

Why it changed my workflow: It’s concise and forces me to think in terms of expressions (returning a value) rather than statements (executing a flow). The compiler also helps ensure I’ve covered all enum cases. It turns 12 lines of procedural logic into 5 lines of readable mapping.

5. Raw String Literals (C# 11)

For years, writing JSON, SQL, or HTML inside a C# string was painful because of “escaping.” You had to escape double quotes (\") constantly.

The Old Way:

var json = "{\n" +
           "  \"name\": \"John\",\n" +
           "  \"age\": 30\n" +
           "}";
// Or slightly better with Verbatim strings, but you still double-up quotes
var json2 = $@"{{
  ""name"": ""{name}"",
  ""age"": 30
}}";

The New Way: Raw string literals use three double quotes ("""). You can paste anything inside, and you don’t need to escape quotes.

var json = $$"""
{
  "name": "{{name}}",
  "age": 30
}
""";

Why it changed my workflow: I work with SQL queries and JSON payloads daily. Being able to copy a JSON object from Postman and paste it directly into C# without spending 5 minutes fixing escape characters is a massive quality-of-life improvement.

6. Conclusion

Some developers argue that these are just “syntactic sugar.” I disagree.

When you remove the noise — the braces, the boilerplate imports, the manual constructors, the escaped quotes — you are left with the intent of the code.

Modern C# allows me to write code that reads almost like a requirement document. If you are still sticking to the “old ways” because of muscle memory, I highly recommend trying these features in your next refactor. You won’t want to go back.

Are there other C# features that have become indispensable to you? Let me know in the comments!

Loading

<p>The post Goodbye Verbose Code: 5 Modern C# Features That Changed My Workflow first appeared on Coder Blog.</p>

]]>
https://www.coderblog.in/2025/11/goodbye-verbose-code-5-modern-c-features-that-changed-my-workflow/feed/ 6
How to do Unit Testing for the Core Api Project with Repository https://www.coderblog.in/2023/08/how-to-do-unit-testing-for-the-core-api-project-with-repository/ https://www.coderblog.in/2023/08/how-to-do-unit-testing-for-the-core-api-project-with-repository/#comments Sun, 13 Aug 2023 01:48:40 +0000 https://www.coderblog.in/?p=964 This is post 8 of 8 in the series “Create a website with ASP.NET Core and Angular” In

<p>The post How to do Unit Testing for the Core Api Project with Repository first appeared on Coder Blog.</p>

]]>

This is post 8 of 8 in the series “Create a website with ASP.NET Core and Angular”

In this series, I will show you how to create the web API with .Net core and communicate with Angular in frontend, and I will keep to update it!

  1. How to setup VS Code environment for ASP.NET Core Project
  2. Use code first to connect database in .Net Core API
  3. Use the Repository pattern in .Net core
  4. Create .Net Core Api controller for CRUD with repository
  5. Use the Serilog in .Net Core
  6. Create Angular Project and Communicate with .Net Core
  7. Create Paging Data from .Net Core Api
  8. How to do Unit Testing for the Core Api Project with Repository

1. Introduction

We have created a .Net Core Api project before, this post will discuss how to do the unit testing for the project.

First question, why should we do the unit testing?

Here are some key reasons why unit testing is important and worth investing:

Finds bugs early – Unit tests help catch bugs early in the development cycle, when they are less expensive to fix.

Improves design – Writing unit tests forces you to think about how your code will be used and drive more modular, reusable code.

Facilitates change – Good unit tests allow developers to refactor code quickly and verifiably. Tests help ensure changes don’t break existing functionality.

Reduces risks – Tests provide a safety net to catch edge cases and errors. They build confidence that refactoring and changes won’t introduce hard-to-find bugs.

Documents code – Unit tests document how production code should be used. They are live examples of how to call various methods.

Enables automation – Automated testing catches issues quickly and frees developers from manual testing. Tests can be run on every code change.

Improves collaboration – Unit tests enable multiple developers to collaborate on code using a shared suite of tests to ensure changes don’t cause issues.

Avoids technical debt – Lack of tests creates a technical debt that slows future development. Writing tests avoid this debt.

2. Create the Unit Testing Project

As I have mentioned before, I like to use VS Code, so I will also base on VS Code and xUnit Test to demonstrate how to do it! 🙂

If you have installed the VS Code extension vscode-solution-explorer then you can easy to create a xUnit Test project from the solution explorer. Just right click the solution and “Add a new project”

then use the xUnit Test Project template, and input the project name MyDemo.Test, then will be created a xUnit Test project

3. Mock Framework

We need to use a mock framework for creating fake objects that simulate the behavior of real objects for testing. So we can install Moq from Nuget for our testing project

4. Create the testing cases

4.1. Mock the Repository

Before we start, we need to create the mock object for repository. Because the mock framework needs to inject into the function logic for testing, so we must use the interfaces programming for the project (like a repository pattern, so this is one of the benefits of using a repository pattern :)).

We can create a MockIUserRepository class to handle user repository testing

//MyDemo.Test/Mocks/MockIUserRepository.cs

using System.Linq.Expressions;
using Moq;
using MyDemo.Core.Data.Entity;
using MyDemo.Core.Repositories;

namespace MyDemo.Test.Mocks
{
    public class MockIUserRepository
    {
        //todo...
    }
}

because we use IQueryable for GetAll in our repository method

public IQueryable<T> GetAll() => _context.Set<T>().AsNoTracking();

so we also need to return the same object for a mock object, then we create the user data as below

public static IQueryable<User> GetUsers()
{
    var users = new List<User>() {
    new User() {
        Id = 100,
        Name = "Unit Tester 1",
        Email = "unit.tester1@abc.com",
        IsActive = true,
        CreatedAt = DateTime.Now.AddDays(-2),
        UpdatedAt = DateTime.Now.AddDays(-2)
    },
    new User() {
        Id = 200,
        Name = "Unit Tester 2",
        Email = "unit.tester2@abc.com",
        IsActive = true,
        CreatedAt = DateTime.Now.AddDays(-1),
        UpdatedAt = DateTime.Now.AddDays(-1)
    }
    }.AsQueryable();

    return users;
}

then we create the mock instance for IUserRepository

var mock = new Mock<IUserRepository>();

setup the mock instance to return a list of users when the GetAll method is called

//get the fake user data
var users = GetUsers(); 
//setup the GetAll and return the user data
mock.Setup(u => u.GetAll()).Returns(()=> users);

setup the GetItemWithConditionAsync and GetWithConditionAsync methods, because these methods need to pass an expression parameter for query data, so we also need to use the Expression<Func<User, bool> for mock the parameter, and this is an async method, so need to use ReturnsAsync for return the value

mock.Setup(u => u.GetItemWithConditionAsync(It.IsAny<Expression<Func<User, bool>>>())).
        ReturnsAsync((Expression<Func<User, bool>> expr) => users.FirstOrDefault(expr));

mock.Setup(u => u.GetWithConditionAsync(It.IsAny<Expression<Func<User, bool>>>())).
                ReturnsAsync((Expression<Func<User, bool>> expr) => users.Where(expr));

the complete codes as below

//MyDemo.Test/Mocks/MockIUserRepository.cs

using System.Linq.Expressions;
using Moq;
using MyDemo.Core.Data.Entity;
using MyDemo.Core.Repositories;

namespace MyDemo.Test.Mocks
{
    public class MockIUserRepository
    {
        public static Mock<IUserRepository> GetMock()
        {
            var mock = new Mock<IUserRepository>();

            var users = GetUsers();

            mock.Setup(u => u.GetAll()).Returns(()=> users);

            mock.Setup(u => u.GetItemWithConditionAsync(It.IsAny<Expression<Func<User, bool>>>())).
                ReturnsAsync((Expression<Func<User, bool>> expr) => users.FirstOrDefault(expr));

            mock.Setup(u => u.GetWithConditionAsync(It.IsAny<Expression<Func<User, bool>>>())).
                ReturnsAsync((Expression<Func<User, bool>> expr) => users.Where(expr));

            return mock;
        }

        public static IQueryable<User> GetUsers()
        {
            var users = new List<User>() {
            new User() {
                Id = 100,
                Name = "Unit Tester 1",
                Email = "unit.tester1@abc.com",
                IsActive = true,
                CreatedAt = DateTime.Now.AddDays(-2),
                UpdatedAt = DateTime.Now.AddDays(-2)
            },
            new User() {
                Id = 200,
                Name = "Unit Tester 2",
                Email = "unit.tester2@abc.com",
                IsActive = true,
                CreatedAt = DateTime.Now.AddDays(-1),
                UpdatedAt = DateTime.Now.AddDays(-1)
            }
            }.AsQueryable();
            return users;
        }
    }
}

4.2. GetUsers testing case

Ok, now we can create the first testing case to get all user data. Get the mock instance and call the repository GetAll method

[Fact]
public void Test1_GetUsers()
{
    //get the mock instance
    var mockUserRepository = MockIUserRepository.GetMock();
    //call the repository to get user data
    var users = mockUserRepository.Object.GetAll();

    //test the result

    //the users should not be null
    Assert.NotNull(users);
    //the users should be an IQueryable<User> object
    Assert.IsAssignableFrom<IQueryable<User>>(users);
    //should be only 2 items in the user list (this is the fake data that we created)
    Assert.Equal(2, users.Count());
}

VS Code can be very helpful to add the actions on the testing case method, you can click the Run Test or Debug Test to run the test

if everything is ok, you will see the testing result in terminal

4.3. Get user by Id testing case

This time we want to test the method GetUser of UserController. We need to create the user controller instance first, as you know there is a constructor for receiving two parameters in the user controller, that’s means we also need to pass these when new it

public UserController(IUserRepository userRepository, ILogger<User> logger)
{
    this._userRepository = userRepository;
    this._logger = logger;
}

but how should we pass the repository and logger objects? Ok, we can also mock them:

//get the user repository mock instance
var mockUserRepository = MockIUserRepository.GetMock();
//create the ILogger mock instance
var logger = Mock.Of<ILogger<User>>();

now we can new a user controller instance

var userController = new UserController(mockUserRepository.Object, logger);

call the GetUser from controller, because the fake user id is 100 and 200, so we try to pass 100 to get a user

//get the user data by id
var result = userController.GetUser(100);

//convert the result to ObjectResult so that we can check the status codes
var objResult = result.Result.Result as ObjectResult;

//convert the result value to our define's ApiResult object, and we can get the user data
var apiResult = objResult.Value as ApiResult<User>;

//test the result values
Assert.NotNull(result);
Assert.Equal(StatusCodes.Status200OK, objResult.StatusCode);
Assert.IsAssignableFrom<User>(apiResult.Data);
Assert.Equal("Unit Tester 1", apiResult.Data.Name);

the complete codes as below

[Fact]
public void Test2_GetUserById()
{
    var mockUserRepository = MockIUserRepository.GetMock();

    //mock the logger
    var logger = Mock.Of<ILogger<User>>();

    var userController = new UserController(mockUserRepository.Object, logger);

    var result = userController.GetUser(100);
    var objResult = result.Result.Result as ObjectResult;
    var apiResult = objResult.Value as ApiResult<User>;

    Assert.NotNull(result);
    Assert.Equal(StatusCodes.Status200OK, objResult.StatusCode);
    Assert.IsAssignableFrom<User>(apiResult.Data);
    Assert.Equal("Unit Tester 1", apiResult.Data.Name);
}

4.4. Create user testing case

You should know the logic and concept, so I just show you the codes below

[Fact]
public void Test3_CreateUser()
{
    var mock = MockIUserRepository.GetMock();
    //mock the logger
    var logger = Mock.Of<ILogger<User>>();
    var userController = new UserController(mock.Object, logger);

    //call the Post method to create a user
    var result = userController.PostUser(new User()
    {
        Id = 300,
        Name = "new user",
        Email = "newTester@abc.com",
        IsActive = true,
        CreatedAt = DateTime.Now,
        UpdatedAt = DateTime.Now
    });

    var objResult = result.Result.Result as ObjectResult;
    var apiResult = objResult.Value as ApiResult<User>;

    Assert.NotNull(result);
    Assert.Equal(StatusCodes.Status200OK, objResult.StatusCode);
    Assert.Equal(true, apiResult.Success);
    Assert.Equal(300, apiResult.Data.Id);
}

4.5. Update user testing case

The codes as below

[Fact]
public void Test4_UpdateUser()
{
    var mock = MockIUserRepository.GetMock();
    //mock the logger
    var logger = Mock.Of<ILogger<User>>();
    var userController = new UserController(mock.Object, logger);

    var result = userController.PutUser(new User()
    {
        Id = 100,
        Name = "update user",
        Email = "updateTester@abc.com",
        IsActive = true,
        CreatedAt = DateTime.Now,
        UpdatedAt = DateTime.Now
    });

    var objResult = result.Result.Result as ObjectResult;
    var apiResult = objResult.Value as ApiResult<User>;

    Assert.NotNull(result);
    Assert.Equal(StatusCodes.Status200OK, objResult.StatusCode);
    Assert.Equal(true, apiResult.Success);
    Assert.Equal("update user", apiResult.Data.Name);
}

4.6. Delete user testing case

Because there is no user data returned by the delete function, so we just need to check the success status from the Api

[Fact]
public void Test5_DeleteUserById()
{
    var mock = MockIUserRepository.GetMock();
    //mock the logger
    var logger = Mock.Of<ILogger<User>>();
    var userController = new UserController(mock.Object, logger);

    var result = userController.DeleteUser(100);
    var objResult = result.Result as ObjectResult;
    var apiResult = objResult.Value as ApiResult<Object>;

    Assert.NotNull(result);
    Assert.Equal(StatusCodes.Status200OK, objResult.StatusCode);

    //check the success whether is true
    Assert.Equal(true, apiResult.Success);
}

In the end, we can run all tests on the class level

and find the result below

5. Summarize

We learned how to do the unit test with the xUnit Test and how to mock the data. There is an important thing you should know if you want to mock data for testing, you must use the interface programming and dependency injection, so if you call the get user method directly from a help method, then you can’t mock it for testing, you can put the method into service and implement from an interface.

The other thing that needs to note is that must use the same parameter type with your method when you setup a mock instance.

Please let me know if you have any ideas for that! 😀

Loading

<p>The post How to do Unit Testing for the Core Api Project with Repository first appeared on Coder Blog.</p>

]]>
https://www.coderblog.in/2023/08/how-to-do-unit-testing-for-the-core-api-project-with-repository/feed/ 8
.NET Conf 2022 in a Nutshell🥜 (Key Highlights to Know) https://www.coderblog.in/2022/12/net-conf-2022-in-a-nutshell-key-highlights-to-know/ https://www.coderblog.in/2022/12/net-conf-2022-in-a-nutshell-key-highlights-to-know/#comments Fri, 09 Dec 2022 00:59:47 +0000 https://www.coderblog.in/?p=713 If you’re like me and didn’t have the time to follow the .NET Conf 2022 , fear not!  Microsoft has

<p>The post .NET Conf 2022 in a Nutshell🥜 (Key Highlights to Know) first appeared on Coder Blog.</p>

]]>
If you’re like me and didn’t have the time to follow the .NET Conf 2022 , fear not!

 Microsoft has teamed up with various venues across the country to host .NET Conf Live Stream events!

In this article, I am going to give you the summary information (of the most important parts) that you need to know. At the end you will be able to say that if you have seen the .NET Conf (wink wink😉) . Join us as we learn about .NET 7, C# 11, .NET MAUI, Visual Studio and more together!

Before we start the summary by going into the different topics that were discussed at the November 8–10 .NET Conf, let’s quickly look at some highlights that I think .NET developers should know about and be proud of what is being achieved!

Index

1. .NET Conf Highlights

1.1. .NET 7 Highlights

1.2. C# 11 Highlights

1.3. Blazor in .NET 7 Highlights

1.4. .NET 7 & Azure Highlights

1.5. Azure Container Highlights

1.6. .NET MAUI Highlights

.NET Conf Highlights

On the first day of the event they revealed a series of amazing highlights and the first of them has to do with the rapid adoption of .NET 6 versus its predecessor .NET 5 (an incredible +1.8x) with almost 6M active users. Fascinating, isn’t it?

Source: .NET Conf 2022

At this very moment it was also revealed that .NET remains the TOP 1 most loved frameworks between 2019 and 2022 (that’s already 4 years!). And little to say about C#, which to this day remains one of the top 5 fastest languages on Github.

Moving on to our .NET developer community (yes, it’s ours! Both you and I are part of this amazing community!), the numbers reveal that almost 50K members have contributed to .NET. 50,000 members! Do you get the idea of what is being achieved? As you can see I am very excited.🥳

Source: .NET Conf 2022

Well, now that we’ve done a little review of the important general data of the event, let’s move on to the heavyweights.

📌Full original video source.NET Conf 2022 Keynote: Welcome to .NET 7 | .NET Conf 2022

.NET 7 Highlights

After the intro made with the higlights, at the .NET Conf they went on to reveal some numbers about .NET 7 and the changes presented compared to previous versions.

First of all we talk about what has been the most talked about in these months about .NET 7, yes, performance.

Source: .NET Conf 2022

We start with the incredible figure that more than 1,000 performance improvements have been made in .NET 7:

  • Almost x2 times more than in .NET 6.
  • x4 times more than in .NET 5.

And yes developers, we are in front of the fastest .NET ever seen.

Following the theme of performance in .NET 7, now it was the turn of the APIs, again surprising us all by their high numbers.

At first they showed that the performance improvement of the .NET 7 APIs compared to version 6 is up to 16% faster (reaching up to 25% extra in requests per second in applications such as Fortunes).

But they not only compared it to its previous version. Also the performance of .NET 7 APIs has been compared to its rivals; Node.js and Java Servlet.

Source: .NET Conf 2022

As you yourself have just seen, the performance of the APIs is huge (up to 7.02M requests per second) compared to its rivals:

  • 219% faster than Java Servlet (2.20M requests per second)
  • 1070% faster than Node.js (0.60M requests per second)

Another point discussed was the performance of the rest APIs comparing gRPC against its rivals, again, beating them by a considerable margin reaching up to 99.8K requests per second.

Source: .NET Conf 2022

Taking these data into account, we can conclude that the performance is:

  • 3.85% faster than Rust
  • 11.63% faster than C++
  • 37.66% faster than Go
  • 44.85% faster than Java (almost half of it!)

It is true that we have been hearing things about minimal APIs for a couple of weeks but I know that maybe some of you don’t know what I’m talking about. Microsoft has been working on super simple APIs to start working on them and with a huge scalability.

Source: .NET Conf 2022

As Gaurav Seth, director of PM for .NET, told us in his presentation:

“We are focused on ensuring everyone can build amazing APIs with .NET quiclky and scale to add powerful features as they need them.”

Let’s quickly move on to another heavyweight that has also been talked about a lot these past few months, Blazor in .NET 7.

📌Full original video sourceState of ASP.NET Core | .NET Conf 2022

C# 11 Highlights

We came to perhaps one of the most important points of this conference, the eleventh version of the C# programming language.

This time we met Mads Torgersen, C# lead designer, and Dustin Campbell, software architect and C# designer.

Source: .NET Conf 2022

In their introduction they told us how the development of C# 11 was structured and organized, and later they began to comment on the different features that this new version brought with it.

If it is true that we have been hearing about these features in recent months, there is not much that we do not know.

In this occasion, apart from the video, I would like to leave the post of Oleg Kyrylchuk, .NET Developer, blogger and Microsoft MVP, and about these C# 11 features.

His explanation is very clear and straight to the point, highly recommended and short reading:

📌Best C# 11 lates features explanation: Explaining New C# 11 Features

📌Full original video sourceWhat’s New in C# 11 | .NET Conf 2022

Blazor in .NET 7 Highlights

This presentation was given by Steven Sanderson, Developer and Architect at Microsoft. He talked about the Roadmap of Blazor releases (which you may already know a bit about how they work).

Source: .NET Conf 2022

The most notable thing that Steven commented is that Blazor’s development over the first few months has focused primarily on .NET MAUI:

“…the new Blazor Hybrid feature that allows you to run your Blazor components within a native mobile or desktop application.”

On the other hand, Steven comments that in the last few months development focused on adding new features to Blazor in .NET 7:

Source: .NET Conf 2022

As Steven said in his presentation:

“… most of them work across all the different Blazor hosting models so, whether you’re using Blazor Server or WebAssembly or Hybrid with .NET MAUI, most of these features will work in the same way across all of them.”

📌Full original video sourceWhat’s new for Blazor in .NET 7 | .NET Conf 2022

.NET 7 & Azure Highlights

We go into the new features that .NET 7 brings with Azure. For this, Mélony Qin explains that Azure Functions already has support for .NET 7:

“We also made .NET Framework supported in our Functions before host a few weeks back”

Source: .NET Conf 2022

At this point you may be wondering what are Azure Functions?

To understand it well, let’s assume a scenario where you are a .NET developer (maybe you already are😎) and to start a project you need to set up dependencies and configurations before you start.

This introduction alone is enough for you to understand what Azure Functions does: it provides you with a ready-to-code environment.

Source: .NET Conf 2022

In Microsoft words:

“…Instead of worrying about deploying and maintaining servers, the cloud infrastructure provides all the up-to-date resources needed to keep your applications running.”

📌Full original video sourceState of Azure + .NET | .NET Conf 2022

Azure Container Highlights

We come to another interesting topic, the severles containers for microservices. This time we have Anthony Chu, Product manager working on Azure Container Apps:

Source: .NET Conf 2022

At the beginning of the presentation, Anthony commented that Azure Container Apps is a new Azure service that came out only half a year ago.

Later, Anthony claimed that Azure Container Apps:

“…allows you to build serverless containers for microservices.”

This is very good news because many developers and development teams are increasingly using containers and development environments.

That is why this new feature of Azure will facilitate the creation of containers in a very simple way so that developers can focus 100% on development.

And this was later affirmed by Anthony:

“…you can focus a lot more on building your app and not have to worry about managing any infrastructure.”

At the time, when I heard that I wondered, what can I really build with Azure Container Apps?

If that’s something you’re wondering right now too, you’re in luck because Anthony has provided a direct answer to that question:

Source: .NET Conf 2022

Finally, Anthony discussed application container environments in a little more detail:

“All container apps live in a container apps environment and the environment is basically an isolation boundary.”

Source: .NET Conf 2022

In the image you can see graphically how this works. He also added:

“All applications that you deploy to an environment, share the same virtual network and you can also configure them to use the same logging and observability as well.”

📌Full original video sourceAzure Container Apps with .NET | .NET Conf 2022

.NET MAUI Highlights

The .NET MAUI presentation was given by Maddy Montaquila, PM at .NET MAUI, and David Ortinau, PM at .NET MAUI, Xamarin and much more (I confess I am David’s fan).

Firstly, they expressed their happiness because the adoption of .NET MAUI has been spectacularAzure Container Apps with .NET | .NET Conf 2022

Source: .NET Conf 2022

The graph shows the number of stars on Github and it is that, at the moment, the difference between dotnet/core and dotnet/maui is barely 1K stars having a difference of about 5 years!

Comparison of repository stars: dotnet/core (left) vs dotnet/maui (right)

Obviously, like all the talk about .NET 7, which is all about performance, .NET MAUI is no slouch with improvements of up to 51% faster rendering.

Source: .NET Conf 2022

The comparison table shows this data (tested on a Pixel 5):

  • Xamarin.Forms with 179.38 LOLs/sec
  • .NET 6 MAUI with 327.44 LOLs/sec
  • .NET 7 MAUI with 493.08 LOLs/sec
  • .NET Android with 594.33 LOLs/sec
  • Java with 682.97 LOLs/sec

I’m very sure you’ll be asking me at this point:

What the fvck is the LOLs/sec?

Well then, it has an explanation but before you figure it out, I want to ask you to comment “LOL” if you have really asked yourself that question.

I want to see a lot of LOLs to know how many people have really wondered about this!

The explanation for this… Well, you’d better read this excerpt from .NET 7 Performance Improvements in .NET MAUI:

Source: .NET 7 Performance Improvements in .NET MAUI

Yes, they used LOLs on the screen for testing:

LOLs Benchmark (Source: jonathanpeppers/lols)

Did you know this benchmarking technique before? At least I didn’t.

Finally, David showed the roadmap for the release and support for .NET MAUI and one of the things to highlight in this roadmap is that support for the Xamarin SDKs will end in May 2024.

Source: .NET Conf 2022

📌Full original video sourceState of .NET MAUI | .NET Conf 2022 & What’s new in .NET MAUI and Desktop Apps | .NET Conf 2022

Loading

<p>The post .NET Conf 2022 in a Nutshell🥜 (Key Highlights to Know) first appeared on Coder Blog.</p>

]]>
https://www.coderblog.in/2022/12/net-conf-2022-in-a-nutshell-key-highlights-to-know/feed/ 4