2012 was an amazing year, here’s a summary!

Posted by Filip Ekberg on January 8 2013 1 Comment

Saying that a lot happened in 2012 is probably an understatement. At least both on this blog and in my personal life, a bunch of amazing things have happened. I really hope that your previous year was good and let’s hope for an even better 2013. To start this year off I want to summarize […]

Vote on HN

C# Smorgasbord will soon be available!

Posted by Filip Ekberg on July 21 2012 1 Comment

UPDATE: C# Smorgasbord is now available! Since the fall 2011 I have been working on a book called C# Smorgasbord. The book is inspired by all the interesting topics that I’ve touched in this blog. I’m proud to announce that the book will soon be available for purchase on Amazon and CreateSpace! You will also […]

Vote on HN

A summary of 2011 and a look at what is about to come

Posted by Filip Ekberg on January 5 2012 5 Comments

Happy 2012 folks! I hope you all had a wonderful new years eve! The year 2011 has been very interesting, we’ve had the opportunity to see some very exciting things that is about to reach the market. I’d like to summarize what I’ve been writing about in 2011 and breifly tell you guys what’s about […]

Vote on HN

Creating a Dynamic Method that uses a Switch

Posted by Filip Ekberg on October 18 2011 1 Comment

We’ve looked at some very interesting Dynamic Method creation in the last posts and let’s keep this up! We’ve looked at how we can compare values and then jump somewhere if the comparison is evaluates to true. Now let’s take a look at how we can implement a switch! So I was thinking that I […]

Vote on HN

Creating a recursive dynamic method that calculates factorial

Posted by Filip Ekberg on October 17 2011 Leave a Comment

In the last post we looked at how we could call a dynamic method, now let’s have a look at how we can create a recursive method that calculates factorial for non-negative integers! First of all we should take a look at what factorial means, usually it’s written like this: 5! Which means that it […]

Vote on HN

Calling a dynamic method from a dynamic method

Posted by Filip Ekberg on October 16 2011 Leave a Comment

Let’s take a look at how we can call a method from a dynamic method. In the last post we looked at how we called a static method in our current context, but let’s take a look at how we can call another dynamically created method that takes an integer parameter and then does some […]

Vote on HN

Exploring OpCodes with DynamicMethod and looking at the evaluation stack

Posted by Filip Ekberg on October 16 2011 1 Comment

In the previous post we looked at how our DynamicMethod could pass a value to another method, let’s take a look at something a little bit more interesting! Consider that I want to have a method that takes an integer and this integer is manipulated and then printed out by this method. In this case, […]

Vote on HN

Calling a non-dynamic method with parameters from a dynamic method

Posted by Filip Ekberg on October 14 2011 Leave a Comment

I think it’s time that we explore some more OpCodes and in this post I will look at how we can call methods with parameters passed to them! There are two OpCodes that we can use to execute a method these are: OpCodes.Call OpCodes.Jmp The difference between these two are important, the first one OpCodes.Call, […]

Vote on HN

Getting information about a method and its local variables

Posted by Filip Ekberg on October 12 2011 Leave a Comment

Sometimes it can be useful to get information about a method such as getting all the local variables. We’ve looked at how we can retrieve information about known types and setting / getting their values. Now let’s take a look at how we can get information about a method and it’s local variables in runtime! […]

Vote on HN

Exploring reflection – Finding a value in any of the objects properties

Posted by Filip Ekberg on October 8 2011 4 Comments

I want to explore reflection by playing with both reflection, anonymous types and dynamically typed things all at once! My goal is not to be confusing or anything, but it is to leave out the parts that are redundant. So let’s get to it! I sometimes find myself having a lot of data that I […]

Vote on HN

Playing with anonymous types in C#

Posted by Filip Ekberg on October 6 2011 6 Comments

In C# 3.0 something called anonymous types was introduced, this means that a certain context can have a type that is not defined anywhere except in that context. This has been seen a lot in LINQ-queries over the years. Here’s an example of an anonymous type: var person = new { Name = "Filip" }; […]

Vote on HN

Using dynamic in the real world with IronPython

Posted by Filip Ekberg on October 4 2011 Leave a Comment

My last posts have been a lot about what you can do to explore the dynamic world in .NET and what it might be good for. But I think it’s time for some real fun with dynamic! So go ahead and fire up Visual Studio, see to it that you got NuGet installed, now let’s […]

Vote on HN

Invoke a dynamic object as if it were a method

Posted by Filip Ekberg on October 3 2011 1 Comment

In my previous post I talked about how you can extend the DynamicObject so that you can override TryInvokeMember and TryGetMember. However, these are not the only methods that you can override. I wanted to take a brief moment and talk about one of the other methods that you can override as well, this being […]

Vote on HN

Extend your objects with DynamicObject to get a dynamic experience

Posted by Filip Ekberg on October 2 2011 Leave a Comment

If you have ever programmed in a dynamic programming language you know that you can pretty much ask for anything on any object, consider this code in any dynamic programming language: var person = new Person(); person.Name = "Filip"; person.Location = "Gothenburg"; In the Person-structure used above, the property Location actually doesn’t exist, but in […]

Vote on HN

Adding properties and methods to an ExpandoObject, dynamically!

Posted by Filip Ekberg on October 2 2011 4 Comments

Meanwhile I am planning and writing manuscript and code samples for my upcoming video series that will cover “Programming fundamentals using C#”, I thought it was time for a short post on some dynamic programming in C#! Another thing worth mentioning is that I will be using Visual Studio 11 Developer Preview, if you haven’t […]

Vote on HN