Avatar of The Sharp Ninja

The Sharp Ninja

Senior Technology Leader at Kforce
Senior Technology Leader at Kforce·
The XAML Family Tree WPF Based Frameworks
WPF (Win32)
    + UWP/WinRT [Extends WPF Syntax] (Win 8, 8.1, 10, XBOX One)
    + WinUI2 [Extends WPF Syntax]
      + Uno Platform (Android, iOS, MacOS, Linux, WASM)
      + UWP/WinRT (Win 10, 11, XBOX One)
    + WinUI3 [Extends WPF Syntax]
      + Uno Platform (Android, iOS, MacOS, Linux/GTK, Linux/Frame Buffer, Tizen, WPF, WASM)
      + Windows App SDK (Win 10, 11)
    + NoesisGUI [Extends WPF Syntax] (Unity 3D, other C# and C++ Based Platforms)
    + Avalonia [Similar to WPF Syntax, but not a true extension of it] (Android, iOS, MacOS, Win32, WASM)
Non-WPF Based Frameworks
Xamarin Forms [Proprietary Syntax] (Android, iOS, UWP/WinRT)
    + MAUI [Extends Xamarin Forms Syntax] (Android, iOS, MacOS, UWP/WinRT, Win App SDK, WASM)
READ MORE
Reddit - Dive into anything (reddit.com)
7 upvotes·7K views
Senior Technology Leader at Kforce·
Shared a protip
on
C#C#.NET.NET

With C#, you may compile as such:

  • Plain MSIL with external refs to assemblies that may or may not be platform specific. Requires the runtime to be on the path or in the same folder.
  • CPU-specific with external refs to assemblies that may or may not be platform specific. Requires the runtime to be on the path or in the same folder.
  • CPU-and-OS-specific with external refs to assemblies that may or may not be platform specific. Requires the runtime to be on the path or in the same folder.
  • CPU-and-OS-specific with bundled, but not pruned (tree-shaking) assemblies that may or may not be platform specific that are embedded in the linked With C#, you may compile as such:

  • Plain MSIL with external refs to assemblies that may or may not be platform specific. Requires the runtime to be on the path or in the same folder.

  • CPU-specific with external refs to assemblies that may or may not be platform specific. Requires the runtime to be on the path or in the same folder.

  • CPU-and-OS-specific with external refs to assemblies that may or may not be platform specific. Requires the runtime to be on the path or in the same folder.

  • CPU-and-OS-specific with bundled, but not pruned (tree-shaking) assemblies that may or may not be platform specific that are embedded in the linked xecutable. Requires the runtime to be on the path or in the same folder.

CPU-and-OS-specific with all dependencies (assemblies or static libraries) included as a single assembly with unnecessary code pruned from the executable. Even the runtime is included in the single output file.

READ MORE
Reddit - Dive into anything (reddit.com)
7 upvotes·1 comment·4K views
Palaash Atri
Palaash Atri
·
February 9th 2023 at 12:17PM

Insightful. My friends struggle a lot with C# so it would help them a lot.

·
Reply
Senior Technology Leader at Kforce·
Shared a protip
on
C#C#sqlsqlPowerShellPowerShellXMLXML

I would focus secondarily on SQL, XML and PowerShell. These are to harness specialized functionality that C# thrives with, not competes with. I have never met a developer who happily moved from C# to another platform. Usually they express misery and longing to leave whatever craptastic platform was forced on them. I realize this isn't the spirit of your question, but it's the only realistic answer I can give.

READ MORE
Reddit - Dive into anything (reddit.com)
3 upvotes·934 views
Senior Technology Leader at Kforce·
Why I Fell in Love With Local Functions in C#! The Touchy Feely Part

Lambdas have been a fantastic addition to C# since way back when they were first introduced with C# 3.0, having provided the capabilities needed for LINQ and it’s assortment of extension methods. You can say that Lambdas may be the most significant improvement in any new version of C#.

Local Functions were introduced with C# 7.0 and are also transformative in how code can be written, thought not as much as Lambdas were. Still, many people don’t even know Local Functions exist, so let’s get the word out!

From a coding style perspective, I’ve always felt the syntax of a Lambda looks odd, and it took me a while to wrap my head around their intricacies to be fluent with them. Local Functions are just functions. You declare them like any other function, just they are declared inside of another function.

Another thing I love about Local Functions is that it allows you to hide functions from other members of the object.

The Technical Part

Local Functions and Lambdas share a lot in common. They can both access the same set of parameters, locals, instance and static items. They can both be used as a delegate, although Lambdas must always used as a delegate.

But there are some major differences. First, Local Functions do not require a delegate to be used when called as a normal function. This saves on object instantiation whenever the Local Function is used as a normal function. Calls to a Local Function can be inlined when used as a normal function, which can drastically increase the performance of your application. Lambdas can never be inlined and as such can be a significant detriment to performance.

Local Functions can be generic, while Lambdas cannot. This has all kinds of benefits, especially with recursion (which is very difficult with Lambdas to begin with). If you’ve got a weakly typed path through your code and need a strongly typed section of repeatable code, then a generic Local Function has you covered.

Local Functions can also be iterators using the yield return pattern. Lambdas are not re-entrant and thus cannot be iterators.

Local Function as a Mutating Iterator

Conclusion

Microsoft has a good write-up about the differences between Local Functions and Lambdas. There is also this excellent answer on Stack Overflow. Personally, the combination of stylistic and technical advantages really seals the deal for me. If you’ve got a quick scenario where you’re using a method group of another object as the delegate of an Action or Func<>, then a Local Function is overkill syntactically and technically. But that’s about the only use case where I personally use Lambdas now.

READ MORE
Why I Fell in Love With Local Functions in C#! | by The Sharp Ninja | The Unpopular Opinions of a Senior Developer | Medium (medium.com)
1 upvote·393 views