Contents tagged with c#
-
Finding a row in a DataTable
If you have a System.Data.DataTable that contains the columns {ItemId, ItemName, ItemQuantity} and wanted to find the record for a given ItemId, you could always use the followind code:
int …
-
An attempt was made to load a program with an incorrect format
Could not load file or assembly 'NameOfAssemblyGoesHere' or one of its dependencies. An attempt was made to load a program with an incorrect format.
This message being spewed- …
-
Exclude SCC / VSSSCC files from Web Setup Projects
The structure of a Web Setup Project (.vdproj) file is just plain strange as it's "kinda" like XML but with curly braces ( { and } ) and quotes instead of < and > symbols.Go figure.
If you have a …
-
Formatting a number to be zero-padded
int i = 3;string padded = string.Format("{0:5D", i);
Gives a value of "00003" as the string called "padded" - that simple.
-
Reflecting on Excel
Gabhan Berry has some really interesting (and potentially useful!) stuff that mainly centres around programming with Excel. One of the most interesting entries is one regarding dealing with Optional …
-
Delusional Ramblings of an Angry Coder
Take a look at Mark: Ramblings from a programmer, if you dare. Whilst some of the points he makes are good, for example that Visual Studio doesn't inherently encourage programming best practice, i.e. …
-
Converting Request.InputStream to a string - Part 2
Preceded by: Converting Request.InputStream to a string - Part 1 A natural extension to this, is the ability to transform the InputStream (basically the POST data) into an XMLDocument and then parse …
-
Converting Request.InputStream to a string - Part 1
Nowhere could I find a simple, concise way of converting the Request.InputStream from an ASP.net page into a string ready for processing, something which is very useful to do if you're passing a …
-
Obtaining the string value of an enumeration name
A useful trick I've picked up recently is the ability to get the name of a value of an enumeration in C#. Using the following example enumeration:
enum fruit{ apples, pears, oranges}
The …