Serializing Mail Messages
Posted in C# Programming on July 13th, 2010 by phoenixdigitalUseful classes for serializing mail messages
http://nayyeri.net/how-to-serialize-a-mailmessage
and
http://gopi.codeplex.com/
Useful classes for serializing mail messages
http://nayyeri.net/how-to-serialize-a-mailmessage
and
http://gopi.codeplex.com/
When a page is loaded the execution order is
1 2 3 4 5 | Page_Init(object sender, EventArgs e) {} Page_Load(object sender, EventArgs e) {} Page_DataBind(object sender, EventArgs e) {} Page_PreRender(object sender, EventArgs e) {} Page_Unload(object sender, EventArgs e) {} |
http://support.microsoft.com/kb/305141
Useful lookup of variable types available in c#
| C# Type | .Net Framework (System) type | Signed? | Bytes Occupied | Possible Values |
| sbyte | System.Sbyte | Yes | 1 | -128 to 127 |
| short | System.Int16 | Yes | 2 | -32768 to 32767 |
| int | System.Int32 | Yes | 4 | -2147483648 to 2147483647 |
| long | System.Int64 | Yes | 8 | -9223372036854775808 to 9223372036854775807 |
| byte | System.Byte | No | 1 | 0 to 255 |
| ushort | System.Uint16 | No | 2 | 0 to 65535 |
| uint | System.UInt32 | No | 4 | 0 to 4294967295 |
| ulong | System.Uint64 | No | 8 | 0 to 18446744073709551615 |
| float | System.Single | Yes | 4 | Approximately ±1.5 x 10-45 to ±3.4 x 1038 with 7 significant figures |
| double | System.Double | Yes | 8 | Approximately ±5.0 x 10-324 to ±1.7 x 10308 with 15 or 16 significant figures |
| decimal | System.Decimal | Yes | 12 | Approximately ±1.0 x 10-28 to ±7.9 x 1028 with 28 or 29 significant figures |
| char | System.Char | N/A | 2 | Any Unicode character (16 bit) |
| bool | System.Boolean | N/A | 1 / 2 | true or false |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public new TList<T> FindAll(Predicate<T> match) { if (match == null) { throw new ArgumentNullException("match"); } TList<T> result = new TList<T>(); foreach (T item in this.Items) { if (match(item)) { result.Add(item); } } return result; } |
1 | list.FindAll(delegate(TempAddItem t) { return t.ShortCode.Trim() == 'Test'; }); |
I have been able to add indentation to dropdown boxes to allow for easier user viewing in many languages… until I met .NET. For some reason when adding spaces to the text in a ListItem the spaces are magically removed.
I was wanting to acheive a DropDownList like below.
Also at the end of this post is a way to achieve the unselectable headings in the example above.
A quick simple note on how to add prepending zeros to a number
1 2 | int nMaxNumber = 3; string strValue = string.Format("{0:0000}", nMaxNumber); |
strValue will contain 0003
I will add more examples as I need them
Ref: http://blog.stevex.net/string-formatting-in-csharp/
Here is a post so I can easily find the correct format for dates
1 2 3 4 5 6 7 8 9 10 11 12 13 | // create date time 2008-03-09 16:05:07.123 DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123); String.Format("{0:y yy yyy yyyy}", dt); // "8 08 008 2008" year String.Format("{0:M MM MMM MMMM}", dt); // "3 03 Mar March" month String.Format("{0:d dd ddd dddd}", dt); // "9 09 Sun Sunday" day String.Format("{0:h hh H HH}", dt); // "4 04 16 16" hour 12/24 String.Format("{0:m mm}", dt); // "5 05" minute String.Format("{0:s ss}", dt); // "7 07" second String.Format("{0:f ff fff ffff}", dt); // "1 12 123 1230" sec.fraction String.Format("{0:F FF FFF FFFF}", dt); // "1 12 123 123" without zeroes String.Format("{0:t tt}", dt); // "P PM" A.M. or P.M. String.Format("{0:z zz zzz}", dt); // "-6 -06 -06:00" time zone |
as well as the way to call TryParseExact
1 2 3 4 5 6 | DateTime completedDateEnd; if (DateTime.TryParseExact(Request["completedDateEnd"], "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal, out completedDateEnd) { // do stuff } |
also remember to add this to the using statements at the top of the page
1 | using System.Globalization; |
Handy little program to test on the various versions of IE
Sure to cause no end of frustration getting layouts to look the same in all versions.
Sometimes you may be required to send some data to a remote site from the code behind via HTTP. Generally this can easily be perfomed if the site allows for GET submissions. However sometimes the site will only accept POST submissions.
Read more »
If you notice the style is missing from your AjaxToolkit Tab Container. It could be due to the fact that when your page first loads this element is not visible either due to a surrounding div not being visible. This may cause the stylesheet for the Tab container not to load on subsequent postbacks when you make the Tab Container visible.
Read more »