<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>C# on Andrew Walsh</title><link>http://awalsh128.com/tags/c%23/</link><description>Recent content in C# on Andrew Walsh</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><copyright>© 2026 Andrew Walsh</copyright><lastBuildDate>Wed, 30 Mar 2016 23:52:15 -0700</lastBuildDate><atom:link href="http://awalsh128.com/tags/c%23/feed.xml" rel="self" type="application/rss+xml"/><item><title>State behavioral pattern to the rescue.</title><link>http://awalsh128.com/state-behavioral-pattern-to-rescue/</link><pubDate>Mon, 17 Mar 2014 00:00:00 -0700</pubDate><guid>http://awalsh128.com/state-behavioral-pattern-to-rescue/</guid><description>&lt;h3 class="relative group"&gt;The Creeping Problem&#10; &lt;div id="the-creeping-problem" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-creeping-problem" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;I recently found myself developing a request-response style system,&#10;where the lifetime of a request could be interrupted at any moment. For&#10;most same process execution, like your average desktop application, this&#10;is a concern, but arises more often when dealing with multiple&#10;coordinated processes. My case ended up being the latter.&lt;/p&gt;</description></item><item><title>PCAP-NG reader for .NET.</title><link>http://awalsh128.com/pcap-ng-reader-for-net/</link><pubDate>Wed, 10 Apr 2013 00:00:00 -0700</pubDate><guid>http://awalsh128.com/pcap-ng-reader-for-net/</guid><description>&lt;h3 class="relative group"&gt;Introduction &amp;amp; Scope&#10; &lt;div id="introduction--scope" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#introduction--scope" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;The PCAP-NG file format is used to store network captured data used by&#10;great programs like &lt;a href="http://www.wireshark.org/download.html" target="_blank" rel="noreferrer"&gt;Wireshark&lt;/a&gt;.&#10;There are several API's available for both&#10;&lt;a href="http://www.tcpdump.org/" target="_blank" rel="noreferrer"&gt;Linux&lt;/a&gt; and &lt;a href="http://www.winpcap.org/" target="_blank" rel="noreferrer"&gt;Windows&lt;/a&gt;&#10;but none that are ported to .NET. I decided to &lt;a href="https://github.com/awalsh128/PcapngFile/" target="_blank" rel="noreferrer"&gt;make&#10;one&lt;/a&gt; for my own use in&#10;building a network traffic replay agent.&lt;/p&gt;</description></item><item><title>Reading and writing large binary data in T-SQL and ADO.NET.</title><link>http://awalsh128.com/reading-and-writing-large-binary-data/</link><pubDate>Wed, 03 Oct 2012 00:00:00 -0700</pubDate><guid>http://awalsh128.com/reading-and-writing-large-binary-data/</guid><description>&lt;h3 class="relative group"&gt;Introduction&#10; &lt;div id="introduction" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#introduction" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;In some cases, you may want to read/write binary data from/to your&#10;relational database. This can be a problem when the data set size&#10;exceeds the memory address size (eg. 32-bit processes) or the &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc534993.aspx" target="_blank" rel="noreferrer"&gt;managed&#10;large object&#10;heap&lt;/a&gt; cannot&#10;load it all without throwing an&#10;&lt;a href="http://msdn.microsoft.com/en-us/library/system.outofmemoryexception.aspx" target="_blank" rel="noreferrer"&gt;OutOfMemoryException&lt;/a&gt;.&#10;In those cases, you will need to load the data into memory in chunks.&#10;Fortunately, the &lt;a href="http://en.wikipedia.org/wiki/Transact-SQL" target="_blank" rel="noreferrer"&gt;T-SQL&lt;/a&gt;&#10;syntax supports this operation.&lt;/p&gt;</description></item><item><title>IMAPI version 2 managed wrapper.</title><link>http://awalsh128.com/imapi-version-2-managed-wrapper/</link><pubDate>Tue, 18 Sep 2012 00:00:00 -0700</pubDate><guid>http://awalsh128.com/imapi-version-2-managed-wrapper/</guid><description>&lt;h3 class="relative group"&gt;Introduction&#10; &lt;div id="introduction" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#introduction" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h3&gt;&#10;&lt;p&gt;Microsoft &lt;a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa366450%28v=vs.85%29.aspx" target="_blank" rel="noreferrer"&gt;introduced native image&#10;mastering&lt;/a&gt;&#10;support in Vista, going forward. The library itself is not too complex&#10;but the latest version of the &lt;a href="http://en.wikipedia.org/wiki/Image_Mastering_API" target="_blank" rel="noreferrer"&gt;image mastering API&#10;(IMAPI)&lt;/a&gt; has some&#10;quirks. This is well documented by &lt;a href="http://www.codeproject.com/script/Membership/View.aspx?mid=208197" target="_blank" rel="noreferrer"&gt;Eric&#10;Haddan&lt;/a&gt;&#10;in his&#10;&lt;a href="http://www.codeproject.com/Articles/24544/Burning-and-Erasing-CD-DVD-Blu-ray-Media-with-C-an" target="_blank" rel="noreferrer"&gt;article&lt;/a&gt;&#10;describing how to build an interop file and use it from .NET.&lt;/p&gt;</description></item><item><title>Writing a TEDS (IEEE 1451.4) parser.</title><link>http://awalsh128.com/writing-teds-ieee-14514-parser/</link><pubDate>Wed, 17 Aug 2011 00:00:00 -0700</pubDate><guid>http://awalsh128.com/writing-teds-ieee-14514-parser/</guid><description>&lt;p&gt;I was tasked recently with writing a parser for TEDS bit stream data.&#10;There is an &lt;a href="http://standards.ieee.org/develop/regauth/tut/teds.pdf" target="_blank" rel="noreferrer"&gt;IEEE published&#10;paper&lt;/a&gt; with an&#10;overview of the standard but it doesn't give any examples for&#10;implementation. I was finally able to find a&#10;&lt;a href="http://standards.ieee.org/develop/regauth/tut/tdl.pdf" target="_blank" rel="noreferrer"&gt;paper&lt;/a&gt; that gave&#10;examples but still had trouble parsing the data. I finally realized&#10;there is not only 2 selector bits after the basic TEDS block but&#10;selector bits inside the standard template (2 in the case of template&#10;25). Here are my main findings:&lt;br&gt;&#10;\&lt;/p&gt;</description></item></channel></rss>