Stories recently tagged with 'Generics'

Generic(Collection) Usage in the .NET Framework(www.davidyardy.com)

submitted by dyardydyardy(199) 1 year, 4 months ago

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 Framework contains the following namespaces:System.Collections, read more...

add a comment |category: |Views: 156

tags: another

Another C# trick: Fluents, Inheritance and Extension Methods (blogs.msdn.com)

submitted by crpietschmanncrpietschmann(11.3k) 2 years, 3 months ago

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 base class of the hierarchy is called PropertyConfiguration which defines a series of Fluent methods that are shared by all sub types: read more...

add a comment |category: |Views: 26

tags: another

.NET Reflection - Generic Method Type Inference of a Boxed Parameter(lakario.blogspot.com)

submitted by LakarioLakario(115) 2 years, 6 months ago

A look into calling a generic method with a boxed parameter and returning a strongly typed, unboxed instance of that method using System.Reflection. read more...

add a comment |category: |Views: 31

tags: another

Complex Keys In Generic Dictionary(vadmyst.blogspot.com)

submitted by VadmystVadmyst(395) 2 years, 7 months ago

How to work with complex keys in generic dictionary read more...

add a comment |category: |Views: 30

tags: another

Creating Objects in C# From Stored Procedures Using Generics(techandit.com)

submitted by bryhbryh(15) 2 years, 10 months ago

How to use Generics in C# to allow you to return an array of data objects directly from a stored procedure class read more...

add a comment |category: |Views: 37

tags: another

Func<T> based generic initializers(subjunctive.wordpress.com)

submitted by bdsuttonbdsutton(525) 3 years, 2 months ago

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. read more...

add a comment |category: |Views: 26

tags: another

Expose New Linq Operations from the HashSet<T> Performance Monster(blog.domaindotnet.com)

submitted by dcarrdcarr(790) 3 years, 5 months ago

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 and maintainable at the same time). It’s astounding just how fast the HashSet<T> collection is. This post will show how to gain additional power that is fully supported from Microsoft which is often overlooked, yet it can solve some of the hardest problems (especially around performance however don’t prematurely optimize!). Linq, HashSet, ORM, NHibernate, Linq to NHibernate, Linq Undocumented, Functional Programming, .NET 3.5 read more...

3 comments |category: |Views: 529

tags: another

Lists: Filter, Map and Reduce - and the Magic of IEnumerator.(honestillusion.com)

submitted by JamesCurran2JamesCurran2(129) 3 years, 5 months ago

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. read more...

add a comment |category: |Views: 61

tags: another

How To Create a WPF Template For a Generic Class (dev102.com)

submitted by razamitrazamit(4545) 3 years, 6 months ago

Have you ever tried to create a DataTemplate for a Generic Class? Here is how you do it. read more...

3 comments |category: |Views: 188

tags: another

Using Generics to Copy Data Between Classes of Different Types(alteridem.net)

submitted by rprouserprouse(1175) 3 years, 6 months ago

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. read more...

add a comment |category: |Views: 22

tags: another

Avoiding Inheritance Dependencies Using Generics and Lambdas(managed-world.com)

submitted by samuel_d_jacksamuel_d_jack(415) 3 years, 7 months ago

A nice implementation of the Command pattern using generics and lambdas read more...

add a comment |category: |Views: 38

tags: another

The problem(s) with value types(blog.activa.be)

submitted by activaactiva(2340) 3 years, 8 months ago

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. read more...

1 comment |category: |Views: 326

tags: another

Generic types and IDisposable, the "using" trick(blog.activa.be)

submitted by activaactiva(2340) 3 years, 8 months ago

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... read more...

2 comments |category: |Views: 560

tags: another

A generic Dispenser class(sharpregion.com)

submitted by yoavsionyoavsion(345) 3 years, 9 months ago

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 resources and is consumed frequently. read more...

add a comment |category: |Views: 9

tags: another

Interesting generic method signature technique(jacobcarpenter.wordpress.com)

submitted by jacobcarpenterjacobcarpenter(40) 3 years, 11 months ago

A generic technique for parameter types influencing subsequent parameter types. read more...

add a comment |category: |Views: 10

tags: another

Books and bits » Blog Archive » The SmartBag to replace the ViewData o(blog.latrompa.com)

submitted by hgarciahgarcia(1534) 4 years ago

Jeffrey Palermo postes about replacing the ViewData on the MVC framework with a generic container called SmartBag. I made a small modification of the code to deal with the 20% of cases stated on the post. Here is the code with those changes. read more...

add a comment |category: |Views: 1

tags: another