• About
  • Privacy Policy
  • Utilities
Darchuk.NET

C#

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

Custom Json.NET serializer

September 29, 2017 by Robert Leave a Comment

Newtonsoft Json.NET is a super popular (#1 most downloaded NuGet package) framework for serializing and deserializing json.  In my experience, I haven’t really had to do much other than use the most basic serialization and deserialization. Sometimes, though, there is a time when the API you’re working with presents you with something goofy.  In my … [Read more…]

Posted in: C#, Web API, Web Development Tagged: API, Deserialization, Json, Json.NET, Serialization, Yext

Defer–For those times you just need to kick something off

September 14, 2017 by Robert Leave a Comment

Sometimes you just need to kick off a process and not care about what happens to it.  The old “fire-and-forget” scenario. Sometimes you want an action to happen after a certain duration of time.  I recently had an application where I would detect a lost connection, and then enter a reconnect loop.  After a set … [Read more…]

Posted in: C#, Unit Testing Tagged: async, await, defer, task, Unit Test

It’s Only You — Ludum Dare 33

August 29, 2015 by Robert Leave a Comment

Ludum Dare is an over-the-weekend video game creation competition that happens three times per year in April, August, and December. Ludum Dare is latin for “To give a game.” There is no prize for winning – you simply get bragging rights. The competition is to foster creativity and encourage people to make a game. Potential … [Read more…]

Posted in: C#, Game, JavaScript, Typescript Tagged: Game, It's Only You, LDJAM, Ludum Dare, Music, Typescript

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

Picture Importer (#1) – Discovering Memory Cards

May 24, 2015 by Robert Leave a Comment

This is Part #1 of a multi-part series on a picture importer I am working on. Picture Importer I’m a (very) amateur photographer. I bought a simple DSLR camera (a Canon EOS REBEL T4i) a few years ago, and since then I’ve been the family photographer at various events. I find that I take a … [Read more…]

Posted in: C# Tagged: 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 … 6 7

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