Properties as types

I also realized that it would at times be useful to use property names as types. Imagine this as generic arguments for a function. This could be useful in situations when you want to be sure that a specific argument comes from a specific object. 

Originally I would define a function like this:

public static T[] get<T>(string property, string value)

And then use generics and reflection to get the specifc T with a specified value on the specified property.

This results in a function call like this:


Now wouldn’t it be nicer, if that function call could be done more like this?

get<Content>(ID => 4)

This would of course mean intellisence on the typing and etc. 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s