Category Archives: C#

Using SocketCAN in .NET Core

SocketCAN is a powerful tool for creating CAN Bus oriented applications on Linux. Popular choices for interfacing with SocketCAN are of course C/C++ or Python using the python-can package. As a huge fan of both SocketCAN and C#, I challenged myself to write the current Wikipedia example entirely in C#. In order to achieve this,… Read More »

CRC Algorithm implementation in C#

Introduction My job requires me to interface with a lot of embedded systems. Often times when communicating with those embedded systems a CRC check value will need to be calculated. A lot of the code I write is in C# and although there a few solutions out there for computing CRCs in .NET/Mono, the majority… Read More »

Asymmetric Cryptography in Practice

Encryption can be broken into either symmetric or asymmetric. Symmetric key cryptography is where the same cryptographic key is used for encryption and decryption. Asymmetric key (public-key) cryptography is where one key (the public key) is used for encryption and another key (the private key) is used for decryption. With the sort of added power… Read More »

WCF Tutorial: A Different Approach – Service Library

Service Library Now that we have defined our service interface – It’s time to implement it. We implement the service contract interface (IMathService) just like we would any other C# interface and the result is our service library. See below for the service library source code: using System.ServiceModel; using MathServiceInterface; using MathServiceInterface.DTOs; using MathServiceInterface.Enumerations; using… Read More »

LINQ queries on non-generic collections

Introduction LINQ (Language-Integrated Query) is a powerful tool of the .NET Framework. As the name implies, it integrates query capabilities directly into C# (or the .NET language of your choice). This article does not aim to be an introduction to LINQ, but rather how to use LINQ queries on non-generic collections (objects of IEnumerable type).… Read More »

WCF Tutorial: A Different Approach – Service Interface

Service Interface At the heart of this WCF solution is the Service Interface which describes the operations that our service supports. In addition, the service interface (contract) assembly also contains the DTOs and SOAP Faults that are to be exchanged over the wire. Personally, I like to organize this assembly by putting DTOs in a… Read More »

Compression and Encryption: Order Matters

Compression then encryption or the other way around? Sometimes we need to compress a file in order to make it easier to transmit. Sometimes we need to encrypt the contents of a file in order to protect that information from prying eyes. Sometimes we need to apply both compression and encryption to a file. At… Read More »

WCF Tutorial: A Different Approach – Introduction

Introduction Windows Communication Foundation (WCF) is a part of the .NET Framework which allows for rapidly building service-oriented applications. Personally, I believe the strongest aspect of WCF is the speed in which you can construct and deploy business applications which require a service oriented architecture (SOA) based solution. WCF is mainly for building SOAP-based web… Read More »