By tag: Generics
0
kicks
Generic(Collection) Usage in the .NET Framework
Generics provide a way for developers to define subroutines, functions, fields, properties as well as classes, structures, interfaces and even delegates in such a way that the parameters are not of any particular type. In a sense the constructs are defined in a generic approach.
The .NET Framewo...
0
kicks
Another C# trick: Fluents, Inheritance and Extension Methods
Here’s a scenario which Damien and I encountered recently.
We needed a way of specifying Facets for properties on Entities, i.e. things like Nullable, MaxLength, Precision etc.
And we needed a class hierarchy because different types of properties have different sets of available facets.
The...
0
kicks
.NET Reflection - Generic Method Type Inference of a Boxed Parameter
A look into calling a generic method with a boxed parameter and returning a strongly typed, unboxed instance of that method using System.Reflection.
0
kicks
Creating Objects in C# From Stored Procedures Using Generics
How to use Generics in C# to allow you to return an array of data objects directly from a stored procedure class
0
kicks
Func<T> based generic initializers
Here is some work I've been doing to simplify initializing List<T> using Func<T>. You can build a simple method and then instead of building a loop to initialize your object you can use a one line initialization statement.
0
kicks
Expose New Linq Operations from the HashSet<T> Performance Monster
Linq is not just about databases. It’s about reading the registry, your hard-disk, or even a list of function pointers to be invoked. Linq is about more event then sets (collections). It’s about making tasks easier in many cases and vastly more powerful (and most importantly your code more readable ...
0
kicks
Lists: Filter, Map and Reduce - and the Magic of IEnumerator.
There are 3 very handy list functions which make dealing with lists a breeze: Map, Filter and Reduce. But along the way of writing them, an important principle of IEnumerator<> comes up.
0
kicks
How To Create a WPF Template For a Generic Class
Have you ever tried to create a DataTemplate for a Generic Class? Here is how you do it.
0
kicks
Using Generics to Copy Data Between Classes of Different Types
The latest in a series of posts exploring how we can reduce the grunt work in copying data between the data layer classes and the user interface classes. This uses a fluent interface to copy all of the data in one line of code rather than property by property.
0
kicks
Avoiding Inheritance Dependencies Using Generics and Lambdas
A nice implementation of the Command pattern using generics and lambdas
0
kicks
The problem(s) with value types
Value types can sometimes cause unexpected behavior. This post explains one of the pitfalls you can encounter when using arrays and lists of value types.
0
kicks
Generic types and IDisposable, the "using" trick
This is another one in the series "heck, I never thought of that"... Like most of these articles, if you already knew this trick, ignore me...
0
kicks
A generic Dispenser class
Feeling ashamed for keeping your clients waiting until your code finally constructs your heavy classes/forms?
This utility instantiates objects in a background thread and aspires to always be "full" to the capacity requested. Useful in cases the object being constructed uses many resour...
0
kicks
Interesting generic method signature technique
A generic technique for parameter types influencing subsequent parameter types.