Convert an object to IDictionary<string, object>

by Sahidul Islam on

If you are familiar with ASP.NET MVC then you might have seen or used a method like this where the method take an object as a parameter and you can pass multiple key pair value through that object. Here is an example of ASP.NET MVC method ActionLink which takes five parameters (overloaded) as input and generate a HTML friendly link:

@Html.ActionLink(“Link text”, “ActionName”, “ControllerName”, 
    new { id = 1 }, 
    new { @class = “html-link”, title = “Some title”, data_id = 1 })


<a href="/ControllerName/ActionName?id=1"  
    class="html-link" title="Some title" data-id="1">Link text</a>

As you can see, here fourth and fifth parameter is an object and we are able to pass multiple key pair value to those objects. It’s very useful when you need one or more anonymous key pair value as input with a friendly way to call the method. Now, if you have a method taking an object as input, like above, you need to convert that object to IDictionary<string, object>.

It all started with a Brainstorming!

by Sahidul Islam on

I still can remember that evening when few students of American International University-Bangladesh (AIUB) were gathered together with few teachers to share their ideas. On that evening everyone was thinking about solving world toughest problems and joining Imagine Cup 2011 including me. That was the day I first heard about the idea of “Third Eye”.

Solving world toughest problems using technology is the concept of Imagine Cup where students are allowed to develop software to solve one or more specific problems and compete with others. Imagine Cup is not only about competition, it’s about doing something greater good for humans.