//
you're reading...
.NET 2.0

A new era for Managed C++

I finally cracked open the new MSDN Library and the first thing I looked up was to see just what has changed for Managed C++.

So far I love the changes, no more ugly code!

Unfortunately, while the code doesn’t look “ugly” anymore it does seem to be full of new keywords which seems to cause lots of clutter. The upside of course is that a lot of confusion seems to be gone once you know the new keywords anyway.

Want to declare a property?

property int Simple_Property;
                    
// property block
property int Property_Block {
    int get();
                    
    void set(int value) {
        MyInt = value;
    }
}

// In implementation file
int MyClass::Property_Block::get() {
  return MyInt;
}

The first line creates a new property called Simple_Property and when compiled a new int variable will be added to the class called __backing_store_Simple_Property automatically. I wish C# had this, the majority of my properties are one line get/sets so I could reduce my 11 lines of code per property down to 1.

Maybe C# 2.0 does have this? I haven’t looked to see if it does yet.

The rest of the code creates a property in the same vein as C# does, its a block of code with get and set parts to it. The large difference here is that you can see that these are still methods and you can separate the implementation of the get or set method from the definition of it.

More later.

[Edited to remove traces of sleep from my wording]

Advertisements

About James

I am a Senior Developer/Consultant for InfoPlanIT, LLC. I previously spent over 7 years as a Product Manager for what eventually became ComponentOne, a division of GrapeCity. While there, I helped to create ActiveReports 7, GrapeCity ActiveAnalysis, and Data Dynamics Reports.

Discussion

No comments yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

Archive

%d bloggers like this: