Geeks With Blogs
Jim Lahman's Blog Fortitude|Endurance|Faith|Teamwork July 2009 Entries
Unmanaged arrays in C# structs
I am creating a Memory Mapped File (MMF) that will act like a circular buffer because it will store "live" 100msec data from a PLC. The controls engineer wanted to send the data to me as tag arrays. So, to mimic these tag arrays, I decided to create a structure the reflects these tag arrays. There are ten arrays in the structure. The first array is an array of two short integers (16-bits) that contain a write and read pointer. The next three array is an array of 1024 bytes, an array of 1024 short ......

Posted On Thursday, July 9, 2009 5:13 PM

C# Constants & Global Variables
Moving from C++ to C#, I discovered that constants in the way I was using them are not supported; however, they can be emulated. they are now defined in their own class as static variables; I go a step further by making them private and only available through a property. Before I show a code example, let's explore static further. When a variable is declared as static, the variable is essentially global. All instances of the class share the same static variable. A static variable is initialized to ......

Posted On Friday, July 3, 2009 8:16 AM

Copyright © Jim Lahman | Powered by: | Join free