C#
Tuesday, February 13th, 2007
I was writing some ASP.NET authentication code last night and was trying to encrypt an authentication ticket using FormsAuthentication.Encrypt(). However, it kept returning null. I banged my head against the wall for about an hour and then went home. As so often happens, I came in in the morning and spotted the problem immediately: the ...
read more
Posted in ASP.NET, C#, Development | 1 Comment »
Monday, February 5th, 2007
I went to WebDD on Saturday. It was quite an interesting event, indeed.
I attended several interesting sessions; from HTML microformats, to Ruby on Rails, to WPF and Microsoft Expression Blend.
Scott Guthrie was the man of the day: large throngs of developers vied for seats in his sessions. His talk on WPF/E was extremely interesting. ...
read more
Posted in C#, Development, Events, WPF, WPF/E, WebDD | No Comments »
Friday, October 6th, 2006
I always forget the binding flags needed to reflect over properties in .NET. So this is mainly an aide-mémoire for myself.
PLAIN TEXT
C#:
PropertyInfo[] props = typeof(MyType).GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
I ALWAYS forget that you need to include the BindingFlags.NonPublic flag!
Posted in C#, Development | No Comments »
Wednesday, October 5th, 2005
Just thought I’d mention Microsoft’s advice on the Structs vs. Classes issue
Consider defining a structure instead of a class if instances of the type are small and commonly short-lived or are commonly embedded in other objects.
Do not define a structure unless the type has all of the following characteristics:
It logically represents a single value, similar ...
read more
Posted in C#, Development | No Comments »
Tuesday, June 7th, 2005
I've never quite been convinced of the value of using structs (pun intended).
Sure, structs are
stack allocated instead of heap allocated
value types instead of reference types
But that doesn't really help you when deciding whether to use them or not. And besides, I read somewhere (can't remember where) that the CLR optimizes heap allocations to the ...
read more
Posted in C#, Development | 4 Comments »