Monthly Archives: September 2005

Updated whoami in C#

Here is cool little .Net version of whoami. It will also show you your current group memberships: using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Security.Principal; namespace WhoAmI { class Program { static void Main(string[] args) { AppDomain myDomain … Continue reading

Posted in C# | 4 Comments

Get Windows Groups from WindowsIdentity

Here is a simple way to enumerate the Windows Groups associated with a WindowsIdentity:           public static List<string> GetWindowsGroups(WindowsIdentity id)        {            List<string> groups = new List<string>();            IdentityReferenceCollection irc = id.Groups;                        foreach ( IdentityReference ir in irc )            {                … Continue reading

Posted in C# | 6 Comments

Simple Line Count for your VS Projects and Solutions.

Compile this code as a Console app, put the Exe in your path.  Then when inside one of your Project directories, just type linecount to see all the lines in all *.cs files in your project dir and all subdirectories.  … Continue reading

Posted in C# | 1 Comment

Talking about Chris Smith’s completely unique view : Neat nuggets of .NET – The Conditional attribute

  Chris Smith’s completely unique view : Neat nuggets of .NET – The Conditional attribute, offered a cool approach to easily compiling different versions of your app (i.e. Trial, Full, 10 user version, etc)   using System.Diagnostics; [Conditional("DEBUG")]static private void … Continue reading

Posted in Uncategorized | 2 Comments

Use Rijndael (AES or TripleDes) to easily encrypt/decrypt byte[]s of any size.

I see encryption question asked a lot.  So here is a tight little sample using both 3Des and AES (Rijndael): // Use TripleDes Sample:Console.WriteLine("Using 3Des.");TripleDESCryptoServiceProvider td = new TripleDESCryptoServiceProvider();// Set td key and iv here.string clearString = "This string will … Continue reading

Posted in C# | 15 Comments

Talking about Linq Resources for C#

  Way too cool.  This is fantastic stuff: Linq Resources

Posted in C# | 2 Comments

Talking about Download details: Windows “Monad” Shell Beta 2 $for .NET Framework 2.0 Beta 2$ x86

  MSH Shell (Monad) Beta2 is no longer NDA and can be found here: Download details: Windows "Monad" Shell Beta 2 $for .NET Framework 2.0 Beta 2$ x86

Posted in C# | 4 Comments