Category Archives: C#

.Net Implicit Casts

Casts A cast is a conversion of data from one type to another, for example from an integer to a float. Implicit Casts An implicit cast is a conversion from one type to another that is automatically assumed by the … Continue reading

Posted in C#, VB.Net | Leave a comment

C#: How to Clone a Generic List

Found on StackOverflow, this is a tidy example of an generic extension method that uses LINQ: [sourcecode language=”c#”] static class Extensions { public static IList Clone( this IList listToClone) where T: ICloneable     {     return listToClone.Select(item => … Continue reading

Posted in C# | Leave a comment

Exception Passing DBNull.Value to a Varbinary Using Parameters.AddWithValue

In .Net it seems reasonable to try to pass a NULL to a SQL Server stored procedure using the following syntax (C#): [sourcecode language=”csharp”] myCommand.Parameters.AddWithValue(“@MyParameter”, DBNull.Value); [/sourcecode] Unfortunately, if the sproc is expecting a parameter of type Varbinary(max), the following … Continue reading

Posted in C# | 1 Comment