Okay, I am posting a link to this awesome example of DPAPI (Data Protection API) for C# and VB.net, mainly for my own reference. If you want to encrypt data in web.config files on shared servers, this is the way to do it. http://www.obviex.com/samples/dpapi.aspx Thanks to Julie Lerman for making me aware of DPAPI.
Posts Tagged ‘C#’
DPAPI in C#
Posted in Everything, Software Development, tagged C#, Security on June 16, 2005 | Leave a Comment »
Question about generics
Posted in Everything, Software Development, tagged C#, Code on May 27, 2005 | Leave a Comment »
In my previous post on Generics, I received a comment from Eddie, who was asking why developers would want to use the following constraint, in the example below, when he would pass the parameters as IComparable interface types. public static bool IsLessThan(T one, T two) where T:IComparable { return one.CompareTo(two) < 0; } public static [...]
Oops
Posted in Everything, Software Development, tagged C#, Code on May 26, 2005 | Leave a Comment »
I forgot to mention in my last post, about Generics, that Sahil Malik helped me out with the solution. Between the two of us we figured out why parameterized constructors are not allowed when creating new instances of generic types. I would have edited my initial post, but the formatting in my blog that displays [...]
C# Generics
Posted in Everything, Software Development, tagged C#, Code on May 26, 2005 | 2 Comments »
I’ve been playing around with generics in C# today. Simply put, generics are akin to templates in C++, only much better. My aim in this post is not to explain the in’s and out’s of generics, in the new 2.0 version of the .NET Framework but to highlight some key points of interest. For a [...]
Suppressing the MODI Popup using C#
Posted in Everything, Software Development, tagged C#, Windows Development on March 6, 2005 | 17 Comments »
For those of you who have never heard of the MODI acronym it stands for the Microsoft Office Document Image writer, which is a virtual printer driver for converting printed content into Microsoft Document Images or TIFF files. The idea for this virtual printer, shipped with Office, is to provide a means for converting output [...]
Expose a .NET Assembly via COM – without RegASM.exe
Posted in Everything, Software Development, tagged C#, Code on January 24, 2005 | 3 Comments »
I kept promising myself I would write a post on how to expose a .NET assembly to COM without having to use RegASM.exe. Someone asked me today for the very code to do this, so I thought now would be as good as time as any to write my post. Microsoft provided a wonderful thing [...]
More on Null and Empty Strings
Posted in Everything, Software Development, tagged C#, Code on January 16, 2005 | 2 Comments »
Following on from Jeff Atwood’s post about comparing a string to empty string (“”), I found out that C# and VB.net do not behave the same when comparing a string that is null. In the following C# snippet, the code will display The String is NOT Null: string s = null; if (s == “”) [...]
Null, Empty Strings and Performance Programmers
Posted in Everything, Software Development, tagged C#, Code on January 12, 2005 | 3 Comments »
Jeff Atwood makes a complaint about “performance programmers” breaking his code. In his example, Jeff shows the following snippet of code: If Value <> “” Then If nvc.Item(name) = “” Then nvc.Add(name, Value) End If End If … which was then changed to by the performance programmer.: If Value <> String.Empty Then [...]
Object References in C#
Posted in Everything, Software Development, tagged C# on December 8, 2004 | 1 Comment »
I have been working with some code written by other developers and it appears that there is some confusion with using the ref prefix on object parameters passed to a function. The following example illustrates some of the code I came across: using System; namespace foo { internal class MyClass { private int _x [...]
Free POP3 Client for C#
Posted in Everything, Software Development, tagged C#, Code on October 29, 2004 | 2 Comments »
Announcing FreePOP3 …. http://www.gotdotnet.com/Workspaces/Workspace.aspx?id=2331c59d-e726-4197-b28f-ba17845153d4 I’ve not had the chance to try this out yet but I plan to. Hopefully it has the feature of leaving messages on the server. Ideally I’d like an IMAP client, but POP3 will work for what I need for now. Anyone know of a free IMAP client for .NET?
