Skip to content

Instantly share code, notes, and snippets.

@Immerseit
Immerseit / EnumClassSample.cs
Created September 16, 2011 09:51
Combine Enum and Class for Extended functionality
// The idea is to collect this kind of parsing nearest possible to the enum itself
// Why? Because the enum is the reason to the Method and are easy to find and modify
// Also it's natural to extend with other kind of parsing. Just insert more methods.
// The main drawback, is that I have to state the enum more explicit (i.e. Something.TypeOf)
// Also the code design appears no standard and would apply if the enum was for internal use in the class.
// So, the question
// How would you do this more nice? I tried abstract, base inheritance, partial. None of them apply.
// This is a shortened down and renamed sample of a code that should be better coded.
@Immerseit
Immerseit / ServiceQueue.cs
Created June 30, 2011 21:18
Not complete ServiceQueue problem that need some help,
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// My problem description. You are welcome to comment/fork your own tried/functional versions of this.
// Appearently I have successed the queue on all needed situations. Except a trivial one, the ervice aren't really dequeue.
// The two methods below is two services that are ranned simultaneous within same application (a Windows Service).
//
// 1# As I can see, the line 'if (queue.TryDequeue(..))' never get looped/waked-up..
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
// The object that will Enqueue, put object into Queue (can be put into a console application)
@Immerseit
Immerseit / ThreadedProcessStarter.cs
Created June 27, 2011 08:42
Simple Process Start & Kill By Threads
static void Main()
{
//Dictionary if there happen to be different software to run, per row.
Dictionary<string,string> actions = new Dictionary<string,string>();
actions.Add("http://www.site1.com", @"C:\Program Files\Mozilla Firefox\firefox.exe");
actions.Add("http://site2.com", @"C:\Program Files\Mozilla Firefox\firefox.exe");
actions.Add("http://site3.org/", @"C:\Program Files\Mozilla Firefox\firefox.exe");
foreach (var row in actions)