Monday, November 08, 2021

Good Parts of C# Language (v1 - v10)

Background: C# 10, along with .NET 6 and Visual Studio 2022, are released in November 2021. 

Here are the good parts in C#:
  1. C#  1: Anders Hejlsberg led the design of C#
  2. C#  2: Generics, nullable, anonymous methods
  3. C#  3: LINQ, extension methods, lambda expressions
  4. C#  4: dynamic, covariance and contravariance 
  5. C#  5: async/await, caller info
  6. C#  6: string interpolation, nameof, using static
  7. C#  7: span, ref struct
  8. C#  8: async streaming, patterns, indices and range
  9. C#  9: record, covariant return types, Lambda discard parameters
  10. C# 10: null parameter checking, lobal using, file namespaces

Tuesday, October 19, 2021

4 Take-aways for .NET Dictionary

Background: .NET has four built-in dictionary/map types.

Here are some take aways. 

  1. Hashtable - Avoid use hashtable because it is weakly typed.
  2. Dictionary<T> - Hashtable strongly typed replacement. Not thread safe
  3. ConcurrentDictionary<T> - Good read speed even in the face of concurrency, but it’s a heavyweight object to create and slower to update.
  4. ImmutableDictionary<T> - No locking required to read but more allocations require to update than a dictionary.

Monday, September 20, 2021

Upgrade to ASP.NET 5.0

ASP.NET Core 5.0 Runtime (v5.0.10) - Windows Hosting Bundle Installer!

I upgraded one of my websites from .NET Core 2.1 to .NET 5. The experience was quite smooth. It took me about 1 hour to upgrade and publish it back to the web hosting vendor. 

Here are the steps:

1. Download ASP.NET Core 5.0 Runtime from the link  for dotnet-hosting-5.0.10-win.exe

2. Update Target framework to from .NET Core 2.1 to .NET 5.0.

3. HostingEnvironment is obsolete. Need to replace it with IWebHostEnvironment.

4. Replace UseMvc() with UseEndpoints(). Here are the details


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
            // Obsolet: app.UseMvc();
            // https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio
            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                // mvc
                endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}");

                endpoints.MapRazorPages();
            });

I used Visual Studio 2022, version 17 preview 4.0 for the upgrading. As of now, Microsoft hasn't published .NET 6, which is scheduled be published along with Visual Studio 2022 in October, 2021. Overall, the upgrade experience is very quick!

Cheers!

Monday, March 22, 2021

PowerToys for Windows 10

After playing with PowerToys for Windows 10, I'd recommend it. It will make the life much easier for the developers. For instance, PowerRename is really handy and powerful which support regular expression renaming. I also tested FancyZones. If you have many console windows open, Fancy Zones will help you manage your windows easily.

PowerToys for Windows 10 comes with the following utilities:

  • Color Picker adds a tool for HEX and RGB color identification.
  • FancyZones adds a window manager that makes it easier for users to create and use complex window layouts.
  • File Explorer Preview Panes adds SVG and Markdown previews to File Explorer.
  • Image Resizer adds a context menu to File Explorer for resizing images.
  • Keyboard Manager adds options for remapping keys and shortcuts.
  • PowerRename adds an option for users to rename files using search and replace or regular expression in File Explorer.
  • PowerToys Run adds a Spotlight-like tool that allows users to search for folders, files, applications, and other items.
  • Shortcut Guide adds a full screen overlay that allows the user to view the windows key shortcuts available in the current window.
Don't take my words. Try it yourself. Search "PowerToys" after installing PowerToys. 

Install PowerToys for Windows 10

Monday, January 11, 2021

Yadex Release v1.2 Published on GitHub

Yadex Retirement is an asset management desktop application to help you reach the goal of F.I.R.(E.) — Financial Independence, Retire (Early.)

     https://github.com/tonyjy/YadexRetirement 

YadexRetirement v1.2 (1/9/2021)

  • Added retirement estimation model, along with actuals so that you can track on your retirement
  • Added risk factor, inflation rate, ROI rate for different cases
  • Break down withdrawals on five categories (cash, 401K, social security, pension, and fixed)

YadexRetirement v1.1 (1/22/2020)

  • Asset total tracking year over year.
  • Asset details tracking year over year.
  • Asset add, update, and duplicate.

To run the executable, please unzip Yadex_v1.2.0_win10-x64_EXE.zip and run Yadex.Retirement.exe

Yadex_v1.2.0_win10-x64_EXE.zip

Author: Tony Jiang

Released Date: 1/9/2021 

https://github.com/tonyjy/YadexRetirement/releases/download/v1.2/Yadex_v1.2.0_.win10-x64_EXE.zip

Thumbs Up to GitHub Copilot and JetBrains Resharper

Having used AI tool GitHub Copilot since 08/16/2023, I’ve realized that learning GitHub Copilot is like learning a new framework or library ...