Showing articles from C# tag
Nancy + Static Content + OWIN + SystemWeb
I've just started working with Nancy to create a new site. It's going to be hosted on IIS and I decided to try and take the OWIN approach. When I got to…
GPG in Outlook 2007 - OutlookGnuPG
A long time ago, I used PGP for signing my email, but I stopped using it. Probably because I didn't quite get the concept yet, but that has changed now. Today I switched to GPG for signing my mail and files, with all the required files running from my memory stick. One thing bothered me however, no Outlook 2007 support at all. There are some plugins around for older Outlook versions, but that didn't quite work out. So I decided to develop my own! And after a few weeks of development and testing, it's done and ready to be set free upon the world.
Modified MVC AccountController for Preview 5
I just downloaded the ASP.NET MVC Preview 5 bits from Codeplex and started on my first experiment.
C# World Of Warcraft Armory Library 0.1
Since I started playing World of Warcraft again, I've taken a bit more of a developer approach to it this time, and after founding a little casual guild, I decided to create a site for it. Also because I'm quite geeky when it comes to statistics, and a bit of a theory crafter, I planned to populate our guild site with lots of stats.
ArrayList Class
Resizeable, unordered, index-based collection. Suffers from boxing/unboxing when working with value types. Implements IEnumerator, allowing foreach…
BinaryReader Class and BinaryWriter Class
Used to read and write binary data from streams. Call the correct Read methods when using a BinaryReader.
BitArray Class
Contains an array of true/false values. Resizable through the Length property. Supports bitwise operations.
BitVector32 structure and BitVector32.Section structure
Used to manipulate the bits of a 32 integer. Used to pack multiple small numbers into one when storage is an issue.
Boxing And Unboxing
Boxing is an implicit conversion of a value-type to the object type. Boxing a value-type will copy the value on the heap, and place a pointer to the boxed…
BufferedStream Class
Provides an buffer for another Stream. Used when the underlying stream is not very efficient in handling constant calls.
CollectionsUtil
Helper method to create a case-insensitive Hashtable or SortedList
Comparer Class
Used as the default comparer when sorting with ArrayList for example. Implements the IComparer interface.
DeflateStream Class
Used to compress and decompress data. Slightly smaller result than GZipStream because of lack of header information. Use for internal use in your own…
Delegate Class
Holds a reference to a method. Declared as a single line, the framework provides the underlying implementation.
Directory Class and DirectoryInfo Class
DirectoryInfo Extends FileSystemInfo with directory specific operations. It is possible to create a DirectoryInfo object for a non-existent directory.…
DriveInfo Class and DriveType Enumeration
DriveInfo Will not work on non-existent drives. AvailableFreeSpace returns the freeBytesForUser. TotalFreeSpace returns the freeBytes.
Encode text by using Encoding classes
Provides information about Encodings. Default .NET Encoding is UTF-16. Notepad has trouble displaying UTF-7 and UTF-32 encoded files, even though the file…
EventArgs Class
Defines the arguments to pass in an event. The EventArgs class is used to raise an event without any data. Derive from EventArgs when you need to pass…
EventHandler Delegates
Provides an easier way to define events, without having to declare a delegate. The EventHandler delegate is used for events without data, while the…
Exception classes
All .NET exceptions derive from the System.SystemException class. All custom exceptions derive from the System.Exception class. For most applications…
File Class and FileInfo Class
FileInfo Extends FileSystemInfo with file specific operations. It is possible to create a FileInfo object for a non-existent file. File Contains static…
FileStream Class
Provides a file specific implementation of a Stream.
FileSystemInfo Class and FileSystemWatcher Class
FileSystemInfo FileSystemInfo forms the base for FileInfo and DirectoryInfo, but not DriveInfo. Information contained by FileSystemInfo is cached on first…
Generic Dictionary class
Generic version of the Hashtable class. Retains the order in which items were added. Contains KeyValuePair internally.
Generic KeyValuePair structure
Internal representation of the generic Dictionary.
Generic List class
Generic version of the ArrayList class. Supports delegates for sorting, see below.
Generic List.Enumerator structure, and Generic SortedList class
Generic version of the Arraylist class. Sorted version of the generic List class. Automatically sorts items based on the key.
Generic Queue class
Exam 70-536 notes.
Generic SortedDictionary class
Generic version of the Hashtable class. Sorted version of the generic Dictionary class. Contains KeyValuePair internally. Automatically sorts items based…
Generic Types
Allows you to use placeholders for parameters, which get defined later by the caller. Allows for strongly typed collections, which enable compile-time…
Group Class and GroupCollection Class
Contains the named and unnamed results of matches in a regex. Unnamed results are numbered starting from 1.
GZipStream Class
Used to compress and decompress data. Slightly larger result than DeflateStream because of extra header information. Use for files that need to be able to…
HashTable Class
Key-value pair based collection. Contains DictionaryEntry objects. Not accessible by index, only by key. Values are returned based on the hash value when…
ICloneable Interface
Enable objects to be cloned. Does not specify if you need to implement deep-copy or shallow-copy. (Problematic in public APIs)
IComparable Interface
IComparable is required for sorting. CompareTo is used for sorting, Equals is used to compare equality. (IEquatable interface) Returns less than 0, 0 or…
IConvertible Interface
Enables a class to be converted to a base type such as Boolean, Byte, Double, or String. C allows widening conversion without any casting, e.g.: going…
IDisposable Interface
Enable assemblies that create an instance of your class to free up any resources the instance has consumed. Only implement IDisposable when one of your…
IEquatable Interface
Enables instances of a class to be compared for equality. e.g.: if (a = = b)
IFormattable Interface
Enable classes to display themselves with greater control than ToString.
IsolatedStorageFile Class
Represents a sandbox location to store application specific data in. Assembly/Machine store for application-level data. Assembly/User store for user-level…
IsolatedStorageFileStream Class
Represents a sandbox location to store application specific data in. Assembly/Machine store for application-level data. Assembly/User store for user-level…
Match Class and MatchCollection Class
Contains the result of matches in a regex.
MemoryStream Class
Provides an in-memory implementation of a Stream. Is meant for temporary streams. Possibly to minimize the time you need to hold another stream open…
NameValueCollection Class
Acts like a StringDictionary which can contain duplicate keys. Values can be retrieved by key and index.
Path Class
Provides helper methods for working with file system paths as strings.
Queue Class
First-in, First-out logic. Acts as a queue of customers in a bank.
Reference Types
Data stored on the heap, a pointer to that data is stored on the stack. The heap gets cleaned by the garbage collector, removing items which don't have a…
Regex Class
Used to work with regular expressions. A good free tool to read and create regexs is Expresso. There are many good tutorials around.
Snippets
csharp struct MyPoint { private int x; private int y; public int X { get { return this.x; } } public int Y { get { return this.y; } } public MyPoint(int…
SortedList Class
Key-value pair based collection. Contains DictionaryEntry objects. Accessible by index and key. Sorts items when they are added.
Specialized Dictionary
Special case dictionaries ListDictionary Used as a HashTable for fewer than 10 items. Implemented as a simple linked list behind the scenes. Same…
Specialized String classes
StringCollection Acts as a strongly typed ArrayList of strings. Equivalent to List with generics. StringDictionary Acts as a strongly typed Hashtable of…
Stack Class
Last-in, First-out logic. Acts as a stack of papers on a desk.
Stream Class
A stream is an abstraction of a sequence of bytes, which helps isolating the programmer from the underlying implementation.
StreamReader Class and StreamWriter Class
Provides extra helper methods intended to read a stream as a string. Calling Close() on a StreamReader will close the underlying Stream as well.
StringBuilder Class
A StringBuilder maintains an internal buffer instead of allocating a new string every time. Initial buffer size is 16 bytes, but can be passed via the…
StringReader Class and StringWriter Class
Used to read and write in-memory strings. StringWriter uses a StringBuilder behind the scenes.
TypeForwardTo Attribute
Attribute to indicate a type has moved from one assembly to another. Enables you to update your assemblies without recompiling the clients using them.…
Value Types
Stored on the stack. Contain a value, not a reference. Inherit from System.Value Exists of built-in types, user-defined types and enumerations. Prefer to…
Design Patterns - Proxy Pattern
Welcome back for another episode in the pattern series! This will also be the last article about Design Patterns, since I've finished reading the Head First Design Patterns book :)
Design Patterns - State Pattern
It's been a while again, but it's time for another pattern. Today we'll look at the State Pattern.
Design Patterns - Composite Pattern
It's been a little while again. I blame myself for installing World Of Warcraft again, too addictive. Anyway, time for the Composite Pattern. This is one I'm having a little trouble with to describe clearly.
Design Patterns - Iterator Pattern
Time for the next part in our series, the Iterator Pattern.
Design Patterns - Template Method Pattern
Time for yet another pattern, the Template Method Pattern. Have a look at all the other patterns in the series as well.
Design Patterns - Facade Pattern
Time for another, simple, design pattern. The Facade Pattern.
Design Patterns - Adapter Pattern
We've seen quite a few patterns so far, and I'm glad so many people like them. Today we'll have a look at the Adapter Pattern.
Design Patterns - Command Pattern
What's a lonely geek to do late in the evening? Write about the Command Pattern of course...
Design Patterns - Generic Singleton Pattern
A little follow up from yesterday's Singleton Pattern, where I asked for some help on how you would approach a generic singleton.
Design Patterns - Singleton Pattern
Today we'll have a look at a well known pattern, the Singleton Pattern. Most people have already heard about this one.
Design Patterns - Abstract Factory Pattern
Time to continue from yesterday's Factory Method Pattern by exploring the Abstract Factory Pattern.
Design Patterns - Factory Method Pattern
I present you with the next pattern in our series, the Factory Method! It took a while to get it out due to a stay in the hospital. (All is fine now :p)
Design Patterns - Decorator Pattern
Following up on the Observer/Event Pattern, it's time for the third pattern, the Decorator Pattern.
Design Patterns - Observer/Event Pattern
Yesterday I described the Observer Pattern and mentioned that the .NET CLR provides this functionality through events and delegates.
Design Patterns - Observer Pattern
Yesterday we saw the Strategy Pattern. Today I want to talk about the Observer Pattern.
Design Patterns - Strategy Pattern
The first pattern I want to talk about is the Strategy pattern, which always reminds me about the Command & Conquer games so I'll simply use it as an…
Long Absence - Design Patterns
It's been a while again, real life issues managed to take over all time... But, I'm regaining ground and winning back some of it ;)
Obfuscation - Making Reverse Engineering Harder
In a previous article I have demonstrated how easy it is to decompile and reverse engineer .NET assemblies using Reflector and Reflexil. I've also shown…
String Concatenation vs Memory Allocation
Over the years, plenty has been written about .net String vs. StringBuilder - concatenation performance Concatenating Strings Efficiently, lots of…
Code Signing as Reverse Engineering Protection
In my last post I spoke about reverse engineering .NET assemblies upon which Gregory asked how to protect his code against it.
Reverse Engineering with Reflector and Reflexil
I've always been a big fan of Reflector, allowing me to have a look in assemblies to learn new things, debug in case of problems and provide useful…
Using PowerShell, Writing and Debugging Cmdlets
The prompt is dead, long live the prompt! That's the feeling PowerShell should give you, the new command line shell from Microsoft. Today, I'll try to…
Writing an Outlook Add-in
Yesterday I talked about personalizing Outlook Today to make it look more sexy. One of the things I had on my Outlook Today, was my picture with a direct…
Sync FLAC Library with iPod
Yesterday I explained how you could manage your iPod through Windows Explorer. Having this ability opens up more powerful ways of managing your iPod. One…
Visual Studio 2008 and PHP Coloring
Visual Studio is a great editor! But when editing other file formats I miss the coloring.
Using DebugView and C#
DebugView is a very nice tool from Microsoft (by SysInternals), which allows you to see debug output from the kernel or Win32, local and remote!
Remoting Server-Side
When the Windows Service was successfully running, a way had to be found to control it. There was a ServiceController class which allowed controlling a…
Boxing/Unboxing In .NET
In the .NET Framework there is a feature called boxing, which goes hand in hand with unboxing. Boxing is an implicit conversion of a value-type to the…
BlogCast - Alternate Data Streams
Some time ago I saw something about Alternate Data Streams, but I can't find the source anymore to give credit :(
Stream Music over WiFi - JustePort - .mp3 support needed
Right, about 2 weeks ago Jon Lech Johansen released Justeport, a tool to stream your Apple music files to your Airport Express. <
ConvertToProperties Macro
For everyone who received .NET Magazine 5, there's an article in there at page 53 about cleaning up your code.
Passing bitwise OR enum values
Everyone who has ever used a Regex knows this form of parameter:
Error Reporting To The EventLog - NUnit
For this article, we're going to write a class to write to the EventLog. To allow us for easy error logging.
Using NUnit - Error Reporting To The EventLog
I started working with NUnit a couple of days ago and here is my first attempt at creating something in this new style:
FrontPage Server Extensions - IIS Metabase
Currently I'm playing around with IIS and C, and something I discovered is the following:
Parameterized Queries - MySQL
Today I was looking over a project I'm working on currently, more specifically, at the SQL queries in it.
Differences between PHP and ASP.NET
In response to a thread on the ASP.NET Forums I decided to publish the answers in an overview on my blog.
Birthday - 20 years - Small Console ChatServer
And because of that I'm giving you guys a present. In the form of some articles.
Custom WordWrapper
This article is about a question from chopps on the ASP.NET Forums. He wanted to wordwrap a text to a certain width.
Outlook and C# - Gather Addresses
For this article I decided to work with Outlook from C.
Small Console ChatServer
In this article we'll write a small ChatServer.
Create Hashes - MD5, SHA1, SHA256, SHA384, SHA512
A hash algorithm takes a piece of text and gives a hash as result. This hash is unique for the given text. If you use the hash function on the same text…
Associating your program with every file - ShellExtension
In my last article (C Script) I spoke about adding it to the shell right click menu. Now it's time to implement that.
C# Script
There is VBScript, JScript and PHP. But there isn't anything like C-Script. So, I decided to play around a bit, only as a matter of checking out the…
Including Resources in .exe
As a I reply on my Non-Rectangular Form article, someone asked if you couldn't include the bitmap in the file.
Your program as ShellExtension (Registry) - Including Resources
As a follow up to my C Script program, I've added an article on how to associate your program with every file by adding a registry key.
Non-Rectangular Form
I received some good feedback from my previous article (A Console IRC Bot) and here is the next one.
Non-Rectangular Forms - C#
I added another article in the 'Basic C Examples'-series. ;)
A Console IRC Bot.
I'm planning to write some articles based on questions I get from fellow students.
Basic C# Examples
I was thinking last night, all posts here are very great, and made by all those smart people. But why is it that my fellow students hardly read them? Or…
Setting NTFS Permissions with C#
Today I needed to set NTFS permissions in C on some newly created directories.