The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Archive for the ‘C#’ Category

File scoped namespaces – C# 10.0 draft specifications | Microsoft Learn

Posted by jpluimers on 2025/05/01

Oops, I thought this had been published a long time ago, but oh well: it is never too late to publish reflections on a C# programming language improvement.

After recovering from my rectum cancer treatments and finally upgrading most of my projects to recent enough C# versions, it was time to catch up on useful little C# language features released during my treatments.

This one is really nice: [Wayback/Archive] File scoped namespaces – C# 10.0 draft specifications | Microsoft Learn.

I wish it had been released much earlier, as it so much reminds me of the unit keyword in Delphi which influenced C# a lot. Well, actually the unit actually started in UCSD Pascal and Turbo Pascal; UCSD Pascal ran on the UCSD p-Machine (more on that in a future blog post), which influenced the Java Virtual Machine, which was based on Java bytecode and a Just-in-time compiler in turn influenced the .NET Common Language Runtime.

There are many examples from other languages, paradigms and frameworks: I love how C# and .NET bring so much programming history together.

In Delphi  it is easy: a source file can contain at maximum one unit (and apart from files included in that source file, no other source files can contribute to that unit) and the filename needs to match the unitname, so the unit is a self contained namespace.

Read the rest of this entry »

Posted in .NET, About, C#, C# 10, Cancer, Delphi, Development, Java, Java Platform, Jon Skeet, Pascal, Personal, Rectum cancer, Rider from JetBrains, Software Development, Turbo Pascal, UCSD Pascal, Visual Studio and tools, vscode Visual Studio Code | Tagged: , , , , , | Leave a Comment »

Delphi “array of const” to “varargs” – Stack Overflow

Posted by jpluimers on 2025/04/16

Just in case I ever think “oh, I might try want to go the Variadic function arguments way in Delphi” again, I must remember “maybe not a good idea” and re-read these posts:

Note that this example, despite the description indicates it is, it is actually not varargs by array of const (which requires using TVarRec as under the hood it is an open array of TVarRec): [Wayback/Archive] How to create functions that can accept variable number of parameters such as Format().

Then some Free Pascal links, which is different from, but also similar to Delphi:

Queries:

--jeroen

Posted in .NET, C, C#, Delphi, Development, FreePascal, Pascal, Software Development | Leave a Comment »

From Turbo Pascal to Delphi to C# to TypeScript, an interview with PL legend Anders Hejlsberg – YouTube

Posted by jpluimers on 2025/04/09

Nice historic perspective: [Wayback/Archive] From Turbo Pascal to Delphi to C# to TypeScript, an interview with PL legend Anders Hejlsberg – YouTube

Via [Wayback/Archive] Zack Urlocker on Twitter: “Great interview with @ahejlsberg on the evolution of programming languages, the rise of TypeScript and more. Anders is one of the best programmers I ever worked with. …”

--jeroen

Posted in .NET, Borland Pascal, C#, Delphi, Development, History, JavaScript/ECMAScript, MS-DOS, Pascal, Scripting, Software Development, Turbo Pascal, TypeScript, Windows Development | Leave a Comment »

Note for future self if .NET hash calculations from `ComputeHash()` are slower than expected

Posted by jpluimers on 2025/03/26

Normally when calculating hashes in .NET you use the [Wayback/Archive] HashAlgorithm.ComputeHash Method (System.Security.Cryptography) | Microsoft Learn.

This can be slow as [Wayback/Archive] cmcginty showed while answering the question [Wayback/Archive] How to get an MD5 checksum in PowerShell – Stack Overflow by [Wayback/Archive] Luke101 posing a faster solution (in this case for md5, but it can be generalised):

Read the rest of this entry »

Posted in .NET, C#, Chocolatey, CommandLine, Development, Power User, PowerShell, PowerShell, Scripting, Software Development, Windows | Tagged: | Leave a Comment »

Some notes on recursive lambda expressions in case I ever want to try this myself (spoilers: a lot of study time ahead; many of these links are not live any more)

Posted by jpluimers on 2025/03/20

A sidestep of the series around Writing a tool that restarts the Google Chat desktop app Window (and hopefully the Google Duo desktop app Window too):

Enumerating Windows and especially Child Windows is a recursive endeavour, so I wondered if it was possible to write a self referencing delegate, anonymous method or lambda in C#.

That turns out to be way more complicated than I hoped for.

Some notes below, as:

  • one day I might want to rewrite the core to use this technique just for learning purposes
  • finding these links was quite a bit harder than expected due to link rot often caused by missing redirects (especially on the Microsoft blog sites: for one as not all their blog members are still with them which means content got ditched, and also because they moved through a couple of blog platforms so the really old links to not redirect, not even while tracking them through the Wayback Machine, or the content is incomplete which is why all below links are both in the Wayback Machine and Archive.is)

Here we go:

Read the rest of this entry »

Posted in .NET, C#, Conference Topics, Conferences, Development, Event, Software Development | Tagged: , , , | Leave a Comment »

Writing a tool that restarts the Google Chat desktop app Window (and hopefully the Google Duo desktop app Window too) and some EnumWindows/EnumChildWindows tricks

Posted by jpluimers on 2025/03/19

Earlier this months I wrote Writing a tool that restarts the Google Chat desktop app Window (and hopefully the Google Duo desktop app Window too) promising I would rewrite the Delphi code into C# and integrate it into PowerShell.

This is the beginning on porting the basics of the Delphi code (which had a flaw!) to C# and contains EnumWindows/EnumChildWindows and error handling tricks and tips.

Read the rest of this entry »

Posted in .NET, C#, Conference Topics, Conferences, Delphi, Development, Event, PowerShell, Scripting, Software Development, __Unfinished | Tagged: , , | Leave a Comment »

Enabling XML Auto Commenting C# in Visual Studio Code is in an odd setting (via Stack Overflow)

Posted by jpluimers on 2025/03/18

In Visual Studio Code I already had [Wayback/Archive] C# – Visual Studio Marketplace: C# for Visual Studio Code (powered by OmniSharp) installed in (through code --install-extension ms-dotnettools.csharp), and wanted automatic XML documentation comments generation just like Visual Studio does:

[Wayback/Archive] XML documentation comments – document APIs using /// comments | Microsoft Learn

Read the rest of this entry »

Posted in .NET, C#, Development, Hardware, Java, Java Platform, Keyboards and Keyboard Shortcuts, KVM keyboard/video/mouse, Power User, Software Development, XML, XML/XSD | Tagged: , , , , , | Leave a Comment »

For my link archive: Counting the leading zeroes and ones in a binary number with C#

Posted by jpluimers on 2025/03/13

From a while back, but still interesting:

  1. [Wayback/Archive] Counting the leading zeroes in a binary number with C#
  2. [Wayback/Archive] c# – Getting the number of leading 1 bits – Stack Overflow (thanks [Wayback/Archive] Barry Kelly and [Wayback/Archive] SoapBox)

Especially the first link explains the algorithm very well and is similar to links referred to from the Stack Overflow question as it is based on counting ones (and leading ones are basically leading zeros but bit-inverted).

It also explains a cool thing for leading zeros: modern CPU have instructions which .NET Core.

Read the rest of this entry »

Posted in .NET, AArch64/arm64, Algorithms, ARM, Assembly Language, C, C#, C++, Delphi, Development, Software Development, x64, x86 | Tagged: , , | Leave a Comment »

Writing a tool that restarts the Google Chat desktop app Window (and hopefully the Google Duo desktop app Window too)

Posted by jpluimers on 2025/03/04

In the past, the Google Hangouts desktop app on Windows would integrate with the system “tray” (actually the notification area) and show you missed chats and calls.

The [Wayback/Archive] Google Chat desktop app does not. It shows missed messages only as a number on the taskbar icon. Even worse: when you close the Window, the taskbar application icon does not show that number any more.

The odd thing is that the Google Duo desktop app does stay active and shows a notification popup on incoming calls. The Google Chat desktop app does not.

So I wanted to restart the Google Chat desktop app automatically when the Window was closed. But there is a catch:

Read the rest of this entry »

Posted in .NET, C#, CommandLine, Delphi, Development, PowerShell, PowerShell, Scripting, Software Development | Tagged: | Leave a Comment »

GitHub – Sanakan8472/copy-dialog-lunar-lander: Play lunar lander in you windows file copy dialog

Posted by jpluimers on 2025/02/25

[Wayback/Archive] Sanakan8472/copy-dialog-lunar-lander: Play lunar lander in you windows file copy dialog

Hard

Via:

--jeroen

Read the rest of this entry »

Posted in .NET, C#, Development, Power User, Software Development, Uncategorized, Windows, Windows 10, Windows 11, Windows Development | Leave a Comment »