Navigation


Milos Solution Platform (External Blog)

The Milos Solution Platform is .NET's premier platform for building business applications. This blog is meant for developers who use or evaluate Milos. This blog is used to share tidbits of information provided by the Milos developers at EPS. Many of the posts put the spotlight on new features. We generally recommend that all Milos users (developers) at least scan this blog to keep up with the Milos news.

Content Area Footer

Tuesday, January 06, 2009
Dynamic Property and Method Access

The upcoming version of Milos has a nifty little enhancement in the ObjectHelper class: It makes it easier to dynamically access/set properties and invoke methods. This is useful in scenarios that can otherwise only be handled with Reflection.

Example: Consider a scenario where a customer object is provided by some external system (perhaps from a dynamic language) and you need to access or set a name property. This can now be done like so in Milos:

object customer = GetCustomerObjectFromSomewhere();
string firstName = EPS.Utilities.ObjectHelper.GetPropertyValue<string>(customer, "FirstName");
EPS.Utilities.ObjectHelper.SetPropertyValue(customer, "LastName", "Smith");

Note that these methods are also available as extension methods. To use the extension methods, the EPS.Utilities namespace has to be included at a file level, by putting the following using statement at the top of your source file:

using EPS.Utilities;

Now, the above code can be simplified to the following:

object customer = GetCustomerObjectFromSomewhere();
string firstName = customer.GetPropertyValue<string>("FirstName");
customer.SetPropertyValue("LastName", "Smith");

Milos now also makes it easier to invoke methods dynamically. For instance, one can call a method ont he same object like so:

string name = customer.InvokeMethod<string>("GetFullName", null); 

Note that the second parameter is an array of parameters that get passed to the method. For instance, if the GetFullName() method takes an integer and a string parameter, it could be passed like so:

object[] parameters = { 0, "Test" };
string name = customer.InvokeMethod<string>("GetFullName", parameters); 

Note that C# 4.0 (once released) will provide features to also make it easier to do these things. In C# 4.0, the following syntax would be valid:

dynamic customer = GetCustomerObjectFromSomewhere();
string firstName = customer.FirstName;
customer.LastName = "Smith";
string name = customer.GetFullName(1, "Test");

The example used here, with the Customer object dynamically retrieved somewhere is one scenario where this is useful. There are other scenarios as well, where generic code is written that can operate on types that are defined elsewhere. Data binding scenarios are one example.

  

Posted @ 9:47 AM by Egger, Markus (markus@code-magazine.com) -
Comments (77)




Comments:

RE: Dynamic Property and Method Access
Tuesday, June 21, 2011 9:45 PM by new era - vsg@gcv.com

I may be notified whenever a new post has been made. I have subscribed to your rss feed which must do the trick! Have a nice day!


mac makeup
Tuesday, August 16, 2011 4:07 AM by mac makeup - quan.huang@yahoo.com.cn

Bad luck often brings good luck.


RE: Dynamic Property and Method Access
Wednesday, September 21, 2011 8:00 AM by Android developer - ecomm.company@gmail.com

Interesting blog and its so impressive, i really enjoyed to read your information, i think your blog easily to get good branding and more traffics , because every one to likes your blogs. thanks for your wonderful informative post.


RE: Dynamic Property and Method Access
Thursday, October 27, 2011 12:04 AM by Door latches - tradehandles_uk@hotmail.com

Hello there, I enjoyed reading your post, thanks for this ……. I have noticed one in your pages, it takes so long to load ?


RE: Dynamic Property and Method Access
Tuesday, November 08, 2011 6:41 PM by SWF Converter for Mac - plant2013@gmail.com

Preparation: Free download and install Mac SWF Video Converter, launch it.


Sheath/ Column Wedding Dress
Friday, November 18, 2011 2:02 AM by Sheath/ Column Wedding Dress - zhuiyi3693@yahoo.com

As much work as it was doing most of it DIY, it was totally worth it in the end. Plus, having amazing vendors makes it SO much better! We worked hard up until the day of, then they took over for us,fg so we didn’t have to do a thing except enjoy each other and our friends and family.


Price of Silver Per Ounce
Friday, December 30, 2011 10:35 PM by how to get rid of lice - avenabailey@gmail.com

There is obviously a lot to know about this.I think you made some good points in Features also.


RE: Dynamic Property and Method Access
Friday, December 30, 2011 10:36 PM by how to get rid of dark circles fast - avenabailey@gmail.com

you are right when you say this.Hats off man,what a superlative knowledge you have on this subject.hope to see more work of yours.thanks


RE: Dynamic Property and Method Access
Monday, August 07, 2017 1:49 AM by cheap pandora

Looking to get her a unique jewellery gift with a personal touch? PANDORA offers a wide range of options that allow you to create something special that she will treasure forever.


RE: Dynamic Property and Method Access
Monday, August 21, 2017 2:14 AM by ssg - asa@qq.com

PANDORA bracelet can be their own combination, the bracelet on the chain and the[url=http://www.pandoramagic.co.uk]pandora charm bracelets on sale[/url] chain is used to separate the chain, and then string together. You can first visit the official website model  and then to[url=http://www.pandoracharmscheap.co.uk/category/new disney pandora charms 2017]pandora limited edition charms 2017[/url]the store to buy, decorated with gold, silver, glass, enamel and other materials of different shapes,bracelets have gold, [url=http://www.cheapjewelryonline.co.uk/category/Authentic pandora charm discount for sale]sterling silver birthstone bracelet[/url]silver, fabric, leather and other materials can choose.


RE: Dynamic Property and Method Access
Thursday, March 29, 2018 2:13 AM by Do My Paper For Me

The most fascinating piece of this article begins here as the perplexing dynamic property class contains the center usage of our dynamic properties idea. I should say that we utilized a similar idea to speak to dynamic properties of the content component and organizing objects inside our item for content archive content control.


RE: Dynamic Property and Method Access
Tuesday, April 24, 2018 9:45 AM by entrusted essay writing service online

I would like to use this new method accessing coding in my servers. I have been using the older version off this same, which is released way back some 5 years back. This very good news to the people like me who are using this method accessing coding in our computer now will get new version of it.


Firestarter Guide
Monday, June 25, 2018 7:56 AM by JamesSmith - OtavioMeloSousa@rhyta.com

Firestarter app is the magic stick that let you enjoy all the Android content on your fire TV. Firestarter app launches Android apps on Amazon Fire TV.


RE: Dynamic Property and Method Access
Monday, August 06, 2018 3:04 AM by 192.168.1.1 - panistefanin@gmail.com

Thank you for your work on the blog! You're doing a good job!


Best web Hosting Services
Saturday, November 10, 2018 4:59 AM by Kylie Williams - kyliewilliams0414@gmail.com

You always share all the good and useful information for us. I really got so impressed with your article. Thanks


chibi
Saturday, December 01, 2018 1:18 AM by happy wheels - mailvex3@gmail.com

Excellent reading, I read a lot of posts but I am really impressed with your post. Thanks sir, I will look into this article. To know about me, try talking to me


Advertise on Jobroller
Monday, January 07, 2019 6:24 AM by Advertise on Jobroller - fareedyjob321@gmail.com

I have a mission that I’m just now working on, and I have been at the look out for such information


love spell candle
Wednesday, January 09, 2019 2:31 AM by love spell candle - fareedyjob321@gmail.com

I have been searching to find a comfort or effective procedure to complete this process and I think this is the most suitable way to do it effectively.


COPING WITH DIVORCE
Thursday, January 10, 2019 1:08 AM by COPING WITH DIVORCE - fareedyjob321@gmail.com

This is really very nice post you shared, i like the post, thanks for sharing..


PROPERTY DEVELOPMENT ADVICE
Thursday, January 10, 2019 7:21 AM by PROPERTY DEVELOPMENT ADVICE - fareedyjob321@gmail.com

I need to to thank you for this very good read!! I definitely loved every little bit of it. I have you bookmarked to check out new things you post…


list of businesses
Thursday, January 10, 2019 8:24 PM by list of businesses - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


US datacenter facility
Saturday, January 12, 2019 9:32 AM by US datacenter facility - fareedyjob321@gmail.com

I have been searching to find a comfort or effective procedure to complete this process and I think this is the most suitable way to do it effectively.


http://www.bewertungsdoc.com/
Saturday, January 12, 2019 8:21 PM by http://www.bewertungsdoc.com/ - afiyaali200@gmail.com

Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks


Where can I buy a registered UK driving license
Sunday, January 13, 2019 7:49 AM by Where can I buy a registered UK driving license - fareedyjob321@gmail.com

I don’t think many of websites provide this type of information.


RE: Dynamic Property and Method Access
Sunday, January 13, 2019 7:49 AM by Where can I buy a registered UK driving license - fareedyjob321@gmail.com


RE: Dynamic Property and Method Access
Sunday, January 13, 2019 7:49 AM by Where can I buy a registered UK driving license - fareedyjob321@gmail.com


Pousada em Boiçucanga
Sunday, January 13, 2019 8:17 PM by Pousada em Boiçucanga - afiyaali200@gmail.com

Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks


high quality counterfeit money for sale
Sunday, January 13, 2019 9:52 PM by high quality counterfeit money for sale - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


internet marketing and advertising company
Monday, January 14, 2019 4:50 AM by internet marketing and advertising company - fareedyjob321@gmail.com

Hi! This is my first visit to your blog! We are a team of volunteers and new initiatives in the same niche. Blog gave us useful information to work. You have done an amazing job!


in store merchandise broker
Tuesday, January 15, 2019 8:01 PM by in store merchandise broker - afiyaali200@gmail.com

Precise in-store merchandising is critical to the success of your store or product. Gaps in execution can lead to wasted time, disorganization, a poor customer experience, and lost sales. FreshSource specializes in the placement and line expansion of retail food products in supermarkets throughout the United States (Safeway, Savemart, The Nugget, Raleys, etc, etc, etc). We represent Taylor Farms, Foxy, Green Giant and dozens of successful brands. if you need in store merchandising and retail sales, look no further than FreshSource.


5 best coworking hostels in london
Wednesday, January 16, 2019 5:00 AM by 5 best coworking hostels in london - fareedyjob321@gmail.com

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing abilities has inspired me to start my own Blog Engine blog now. Really the blogging is spreading its wings rapidly. Your write up is a fine example of it.


Daytona Beach Limo
Wednesday, January 16, 2019 10:22 AM by Daytona Beach Limo - afiyaali200@gmail.com

Thanks for another wonderful post. Where else could anybody get that type of info in such an ideal way of writing?


2019 Technology free guest posts sites
Wednesday, January 16, 2019 11:01 AM by 2019 Technology free guest posts sites - afiyaali200@gmail.com

Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks


academic writing services
Wednesday, January 16, 2019 7:58 PM by academic writing services - afiyaali200@gmail.com

Today, I was just browsing along and came upon your blog. Just wanted to say good blog and this article helped me a lot, due to which I have found exactly I was looking.


PS4 Emulator
Wednesday, January 16, 2019 10:15 PM by PS4 Emulator - afiyaali200@gmail.com

Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks


pug
Thursday, January 17, 2019 8:12 PM by pug - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


indigo naturalis psoriasis
Friday, January 18, 2019 8:22 PM by indigo naturalis psoriasis - afiyaali200@gmail.com

Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks


RE: Dynamic Property and Method Access
Friday, January 18, 2019 8:22 PM by indigo naturalis psoriasis - afiyaali200@gmail.com


RE: Dynamic Property and Method Access
Friday, January 18, 2019 8:22 PM by indigo naturalis psoriasis - afiyaali200@gmail.com


copier and printer
Saturday, January 19, 2019 3:22 AM by copier and printer - fareedyjob321@gmail.com

This is really very nice post you shared, i like the post, thanks for sharing..


osrs mobile
Saturday, January 19, 2019 10:40 AM by osrs mobile - afiyaali200@gmail.com

Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks


putlockers movies
Saturday, January 19, 2019 8:32 PM by putlockers movies - afiyaali200@gmail.com

Today, I was just browsing along and came upon your blog. Just wanted to say good blog and this article helped me a lot, due to which I have found exactly I was looking.


atacadao das roupas
Saturday, January 19, 2019 10:08 PM by atacadao das roupas - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


live mobile tv channels
Tuesday, January 22, 2019 10:38 AM by live mobile tv channels - afiyaali200@gmail.com

The article looks magnificent, but it would be beneficial if you can share more about the suchlike subjects in the future. Keep posting.


small business advice
Tuesday, January 22, 2019 8:30 PM by small business advice - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


cat beds
Thursday, January 24, 2019 8:11 PM by cat beds - afiyaali200@gmail.com

This particular papers fabulous, and My spouse and i enjoy each of the perform that you have placed into this. I’m sure that you will be making a really useful place. I has been additionally pleased. Good perform!


Artificial Intelligence Books
Thursday, January 24, 2019 9:53 PM by Artificial Intelligence Books - afiyaali200@gmail.com

A great content material as well as great layout. Your website deserves all of the positive feedback it’s been getting. I will be back soon for further quality contents.


vidmate app  
Friday, January 25, 2019 3:19 AM by vidmate app - afiyaali200@gmail.com

nice bLog! its interesting. thank you for sharing....


taxi to msp airport
Friday, January 25, 2019 8:04 PM by taxi to msp airport - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


how to earn battle points pubg mobile
Friday, January 25, 2019 9:59 PM by how to earn battle points pubg mobile - afiyaali200@gmail.com

Akanagi.com is a website that talks about mobile gaming guides for both Android and IOS. It has the latest guides on how to play fortnite, pubg mobile, mobile legends and much more! Visit Akanagi.com to receive the best mobile gaming guides for both Android and iOS


käy sivulla
Saturday, January 26, 2019 8:31 PM by käy sivulla - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


remote
Sunday, January 27, 2019 10:23 PM by remote - afiyaali200@gmail.com

Superior post, keep up with this exceptional work. It's nice to know that this topic is being also covered on this web site so cheers for taking the time to discuss this! Thanks again and again!


RE: Dynamic Property and Method Access
Monday, January 28, 2019 4:55 AM by locksmith Everett - fareedyjob321@gmail.com

Superbly written article, if only all bloggers offered the same content as you, the internet would be a far better place..


RE: Dynamic Property and Method Access
Monday, January 28, 2019 7:09 AM by car locksmith Issaquah - fareedyjob321@gmail.com

Interesting and amazing how your post is! It Is Useful and helpful for me That I like it very much, and I am looking forward to Hearing from your next..


create your temporary e-mail address
Monday, January 28, 2019 1:03 PM by arman ali - johnsam09949@gmail.com

I need to to thank you for your time due to this fantastic read!! thanks for this such great article!


Pname Com Facebook Orca
Monday, January 28, 2019 8:18 PM by Pname Com Facebook Orca - afiyaali200@gmail.com

This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you.


click here
Monday, January 28, 2019 10:18 PM by click here - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


Buy website traffic
Tuesday, January 29, 2019 9:49 PM by Buy website traffic - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


portland printing
Wednesday, January 30, 2019 2:33 PM by arman ali - johnsam09949@gmail.com

Very good information. Lucky me I ran across your site by accident (StumbleUpon). I have saved it for later!


RE: Dynamic Property and Method Access
Thursday, January 31, 2019 2:16 AM by gmail login

Every morning, I come up here and read new as a habit. I like enjoying a cup of coffee and read your nice posts. You make my day!


Team Latest T20 Rankings
Thursday, January 31, 2019 3:39 PM by Team Latest T20 Rankings - afiyaali200@gmail.com

This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you.


Google Play Ranking Factors
Friday, February 01, 2019 10:01 PM by Google Play Ranking Factors - afiyaali200@gmail.com

This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you.


guest house in springs Johannesburg gauteng
Saturday, February 02, 2019 12:11 AM by guest house in springs Johannesburg gauteng - fareedyjob321@gmail.com

I need to to thank you for this very good read!! I definitely loved every little bit of it. I have you bookmarked to check out new things you post…


indain navy
Saturday, February 02, 2019 8:44 PM by indain navy - afiyaali200@gmail.com

It is truly a well-researched content and excellent wording. I got so engaged in this material that I couldn’t wait reading. I am impressed with your work and skill. Thanks.


top #10 amazon best sellers
Sunday, February 03, 2019 6:48 AM by top #10 amazon best sellers - afiyaali200@gmail.com

I visit your blog regularly and recommend it to all of those who wanted to enhance their knowledge with ease. The style of writing is excellent and also the content is top-notch. Thanks for that shrewdness you provide the readers!


banglalink minute offer
Sunday, February 03, 2019 9:55 PM by top #10 amazon best sellersbanglalink minute offer - afiyaali200@gmail.com

This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you.


fat loss supplements
Monday, February 04, 2019 10:51 AM by fat loss supplements - afiyaali200@gmail.com

The article looks magnificent, but it would be beneficial if you can share more about the suchlike subjects in the future. Keep posting.


RE: Dynamic Property and Method Access
Monday, February 04, 2019 10:51 AM by fat loss supplements - afiyaali200@gmail.com


RE: Dynamic Property and Method Access
Monday, February 04, 2019 10:51 AM by fat loss supplements - afiyaali200@gmail.com


Free Software Download
Monday, February 04, 2019 8:36 PM by Free Software Download - afiyaali200@gmail.com

This is my first time i visit here and I found so many interesting stuff in your blog especially it's discussion, thank you.


fashion jewelry
Monday, February 04, 2019 10:25 PM by fashion jewelry - afiyaali200@gmail.com

I have seen some great stuff here. Worth bookmarking for revisiting. I surprise how much effort you put to create such a great informative website. Your work is truly appreciated around the clock and the globe.


RE: Dynamic Property and Method Access
Tuesday, February 05, 2019 5:43 AM by Free Guest Posting Sites List - Naveedmughal358@gmail.com

Thanks For sharing this Superb article.I use this Article to show my assignment in college.it is useful For me Great Work.


DUBAI TALENT
Wednesday, February 06, 2019 10:00 PM by DUBAI TALENT - afiyaali200@gmail.com

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.


Naveed
Monday, February 11, 2019 4:51 AM by voyance par telephone - Naveedmughal358@gmail.com

I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.


voyance en direct par telephone
Wednesday, February 13, 2019 11:13 AM by voyance en direct par telephone - afiyaali200@gmail.com

Superior post, keep up with this exceptional work. It's nice to know that this topic is being also covered on this web site so cheers for taking the time to discuss this! Thanks again and again!


Bali
Wednesday, February 13, 2019 11:58 PM by https://thinkhostel.com/business-location/bali/ - fareedyjob321@gmail.com

This is really very nice post you shared, i like the post, thanks for sharing..


affordable seo company
Thursday, February 14, 2019 6:02 AM by affordable seo company - fareedyjob321@gmail.com

I read your post and I found it amazing! thank!




Post a Comment:

Comment Title (required)

Your Name (optional)

Your Email (optional)

Your Web Site (optional)

Your Comment (required)

 

 

 

 

 

 

 

Syndication RSS 2.0 RSS 2.0

All My Blogs:
My personal blogs:
Dev and Publishing Dev and Publishing
Travel and Internat. Living Travel and Internat. Living
Other blogs I contribute to:
Milos Blog (US) Milos Blog (US)
VFPConv. Dev Blog (US) VFPConv. Dev Blog (US)
VFPConv. Dev Blog (DE) VFPConv. Dev Blog (DE)

 

Blog Archives
All Blog Posts

2010
    November (1)
2009
    July (2)
    February (2)
    January (1)
2008
    December (1)
    October (3)
    June (1)
    April (3)
    February (1)
    January (1)
2007
    December (1)
    October (2)
    September (2)
    July (1)
    June (2)
    May (4)
    April (6)
    March (8)
    February (3)
    January (2)
2006
    December (2)
    November (2)

 

 

 

This Blog is powered by MilosTM Collaboration Components.