• About
  • Privacy Policy
  • Utilities
Darchuk.NET

C#

AutoFac registering properties as implementations

January 5, 2018 by Robert 1 Comment

Recently I’ve been building out something that is very configurable.  Tons of different settings, switches, numbers… you name it.  Its nice to have things split out into areas of concern – that is, different interfaces identifying the configuration settings pertinent to a particular thing – but then you end up with all of these things … [Read more…]

Posted in: C#, IoC Tagged: AutoFac, C#, Configuration, DI, IoC

Enumerating constants from a class

December 15, 2017 by Robert Leave a Comment

Reflection is kind of like black magic, and whenever I use it I feel like some kind of wizard.  The ability to look into objects and even invoke private methods is pretty darn powerful.  It’s not all that magical, of course, since it is built into the framework… however, you should still be careful because … [Read more…]

Posted in: C#, Reflection Tagged: C#, consts, enumeration, Reflection

Angular 4 routing and .NET core static

November 10, 2017 by Robert Leave a Comment

I’ve found this guide on creating an Angular 4 inside of .NET core very helpful.  One of the steps is to set up .NET core to serve static files: However, if you add routing to Angular 4, there’s an additional step that will allow your routes to resolve correctly in the angular application if a … [Read more…]

Posted in: .NET Core, AngularJS, C#, Web API, Web Development Tagged: .NET Core, Angular, Angular 4, C#, Routing

ConcurrentHashSet

November 3, 2017 by Robert Leave a Comment

System.Collections.Concurrent provides a bunch of thread-safe collections that you can use when doing asynchronous programming without worrying about bad stuff happening. The simplest ones, ConcurrentBag<T> (which allows you to put stuff in and take things out in an unordered way) and ConcurrentDictionary<TKey, TValue> (a key/value set) are simple and easy to use, but there isn’t … [Read more…]

Posted in: Asynchronous, C#, Concurrency Tagged: Ansychronous, async, C#, Concurrent, ConcurrentBag, ConcurrentDictionary, ConcurrentHashSet, Thread Safe

Unit Testing Authentication on a Web API controller

June 23, 2015 by Robert Leave a Comment

This is part of a somewhat broader topic of unit testing that I will probably cover more in depth later. Unit Testing Authentication on a Web API Controller At work I made a Web API Controller that has a POST method on it to allow someone to forcibly suspend another user’s session. This kind of … [Read more…]

Posted in: C#, Unit Testing Tagged: ASP.NET, Authentication, C#, IPrincipal, Unit Test

Picture Importer (#2) – Copying files to the vault

May 31, 2015 by Robert Leave a Comment

In part one I described how to get a list of removable storage devices (memory cards, USB sticks, etc). In this part, we’re going to be able to pick a memory card and transfer the contents into a catch-all “vault.” Picking out good pictures will come in a later post; for now, we’re just going … [Read more…]

Posted in: C# Tagged: C#, Camera Importer

Grabbing a version number from a NuGet package’s file name

May 23, 2015 by Robert Leave a Comment

If you ever want to pull a version number out of a file’s name (like a NuGet package, for example), it is pretty easy with regex.  Of course, I suck at regex.  I always need to look up the syntax and even then I probably won’t get it right.  So, anyway, here is the code … [Read more…]

Posted in: C# Tagged: C#, File Parsing, NuGet
« Previous 1 … 5 6

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