• About
  • Privacy Policy
  • Utilities
Darchuk.NET

Generic

Colorful Console App

February 15, 2019 by Robert Leave a Comment

In a C# console application, you can change the color of the text emitted by Console.WriteLine by setting Console.ForegroundColor and Console.BackgroundColor.  It’s pretty straightforward, but if you want to make the output have different colors to denote different things, its kind of cumbersome to have to set the color and then write the output, and … [Read more…]

Posted in: C#, Generic Tagged: C#, Colors, Console, Csharp, Terminal

C#–Writing Enum extension methods

January 25, 2019 by Robert 1 Comment

Sometimes I find myself wanting a quick way to compare an enum with a list of other enums…  Basically, if the enum is one of these, then do this.  It’s pretty easy to do with Linq, but if you want to do it a few times in a few other places, it pays to be … [Read more…]

Posted in: C#, Generic Tagged: C#, enum, equality, extension

C# Reflection with Generics

June 22, 2018 by Robert 1 Comment

If you find yourself writing a lot of the same code (or copy/pasting it) for similar constructs, you should probably consider using generics.  It allows you to write a base class full of functionality that is basically the same across all of different classes, but in a way that doesn’t tie you to a specific … [Read more…]

Posted in: .NET Core, C#, Generic, Reflection Tagged: .NET, C#, Constructor, Generics, Parameter, Reflection, Template, Type

git pruning local branches

June 15, 2018 by Robert Leave a Comment

Sometimes my git branches end up looking something like this …and its really hard to tell what I’ve already done and merged and what is still in progress.  (I masked the names of the branches because this is actually what my local git repo looks like for a client). I know I should probably just … [Read more…]

Posted in: Generic, git Tagged: branch, cleanup, git, prune, source control

Packing two small numbers into a single byte

April 27, 2018 by Robert 2 Comments

In this day and age, you don’t usually need to think about saving memory.  Need a whole number?  Just use an int!  Who really cares if the maximum value will never get above 255?  Using a byte is just archaic! Well, if you’re looking at optimizing network traffic or database usage, those bytes could add … [Read more…]

Posted in: C#, Generic Tagged: AND, Bit Shift, Bit Shifting, Bitwise, C#, OR

Running a Windows command script as admin

October 20, 2017 by Robert Leave a Comment

UAC is admittedly kind of annoying, but I tend to think of it as a necessary evil when you start looking at all of the things out there that can mess up your computer.  Some things require you to run as administrator.  This isn’t a problem when you can control the executable, but if you … [Read more…]

Posted in: Generic, Security Tagged: Administrator, CMD, Prompt, Script, UAC, Windows

IExpress installer

September 7, 2017 by Robert Leave a Comment

If you’ve ever wanted a quick and dirty installer – and I mean dirty – but not have to pay for something like InstallShield, then look no further than IExpress! According to Wikipedia, IExpress was introduced in versions of Windows 2000 and later, so, its been around for awhile. You can start the IExpress wizard … [Read more…]

Posted in: Generic Tagged: IExpress, Installer, Tools, Utility

Recovering lost OneNote notebooks

August 31, 2017 by Robert Leave a Comment

If you’ve ever had a OneNote notebook that suddenly disappeared on you, this might be a way to get it back.  Not guaranteed, but something that you may not have thought to look. 1. In the search box next to the start menu, type%localAppData%\Microsoft\OneNote 2. This will open a folder similar to this one.  Note: … [Read more…]

Posted in: Generic Tagged: OneNote, Recovery

Recent Posts

  • Allowing trailing JSON commas in ASP.NET Core 3
  • YADNC3JSG–Yet Another .NET Core 3.0 JSON Serializer Gotcha
  • Logging in a .NET Core 3 SignalR client
  • .NET Core 3 unit testing project sdk
  • .NET Core 3.0 Upgrade–New JSON Serializer Gotchas

Recent Comments

  1. Robert on C# Setting Socket Keep-Alive
  2. Oliver Schramm on C# Setting Socket Keep-Alive
  3. John Anderson on Waiting for a keypress asynchronously in a C# console app
  4. Ronald Garlit on .NET Core 3 unit testing project sdk
  5. Ronald Garlit on .NET Core 3 unit testing project sdk

Copyright © 2025 Darchuk.NET.

Omega WordPress Theme by ThemeHall