По-русски Notes

Monday, July 12, 2004

Default binder for class

Let’s write a wrapper around an XML element. The wrapper represents properties for element’s attributes.

Let’s write a wrapper around an XML element. The wrapper represents properties for element’s attributes.

XmlElement e;
XmlWrapper w = new XmlWrapper (e);
String s = @”font-face : sans-serif”;
w.style = s; statement 1

In the example the latter statement should effectively call

e.SetAttribute (“style”, s);

A generated class is a good thing, but what about more dynamic approach? A custom binder could help. But in this situation accessing the methods would be neither readable nor writable:

typeof(XmlWrapper).InvokeMember (“style”, SetField, XmlWrapperBinder, e, {s}); statement 2

Assigning a binder to the class XmlWrapper could help:

[Binder (XmlBinder)]
Class XmlWrapper {…}

Then compiler intelligently places statement 2 in place of statement 1

3 Comments:

At 11/30/2005 7:06 AM, Blogger job opportunitya said...

Incredible blog. I admired your site and I will be
back once again to view it! I use much of my spare
time searching for blogs like yours.
I want you to stop and compare with my plastic surgery breast implant blog.

 
At 12/01/2005 12:12 PM, Blogger job opportunitya said...

Delightful blog. I devote my spare time just
looking for great blogs such as yours. I treasure this
site and will go back!
Everyday of the month you need to peep my plastic surgery minneapolis blog.

 
At 12/01/2005 1:36 PM, Blogger job opportunitya said...

Irresistible blog. I look for blogs like this one
when time allows me to. I enjoyed the site and I'll
check it next time!
Where you been? You have got to look at my michael jackson plastic surgery blog!

 

Post a Comment

<< Home