New Apps

Articles

Tips

Events

Improve Soft Skills

/ / Why Dynamic Programming in C#?



The dynamic programming story in C# can fall into fulfilling categories of need in the way of multiple-language integration, simpler reflection, access to HTML DOM in Web scenarios, and easier COM interop. Some of these categories of need might not apply to your particular situation, and that’s okay because there isn’t anything that says that you have to use a language feature just because it’s there. Therefore, I’ll give you an idea of how someone with a specific need might find value in C# 4.0 dynamic programming.

Most C# developers use multiple tools in a single application to accomplish complex tasks. If you’re writing WPF desktop applications, you’re using C# and XAML. It is quite possible that you might find some open source code that solves a problem, but it might be written in another language such as VB or F#. One of the benefits of .NET since its inception is the ability to have cross-language interoperability and the run-time is even called the “Common Language” Runtime (CLR). In recent years, Microsoft has created dynamic languages, such as IronRuby and IronPython, but developers don’t have an easy way to perform interop with dynamic languages. If you have this need, then you’ll welcome the ease with which C# dynamic programming makes interop between C# and dynamic languages possible.

When performing reflection to run a method on an object, there are several hoops to jump through, including obtaining a reference to an object type, getting a reference to a member info object, determining the type of bindings to use, and then invoking the member. While reflection has an undeniable coolness factor, it still feels like a hack and that’s where C# 4.0 dynamic methods can help. Later in this article, I’ll show you how to just call the object member.

If you write Silverlight applications, you might have the need today or in the future to access the HTML DOM containing your Silverlight control. C# dynamic programming makes this task easier.

Performing COM interop with C# has always been cumbersome; partly because of the need to write extra syntax for conversions, optional parameters, and more. This has left some C# developers with a touch of VB envy because VB has easier COM interop support. One of the purposes of dynamic programming in C# is to help the C# programmer write cleaner syntax in COM interop scenarios.

We have spent some time explaining some of the potential benefits of dynamic programming because it’s so new that the value might not jump out at you immediately.

«
Next

Newer Post

»
Previous

Older Post

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

No comments :

Leave a Reply

Wednesday, April 20, 2016

Why Dynamic Programming in C#?



The dynamic programming story in C# can fall into fulfilling categories of need in the way of multiple-language integration, simpler reflection, access to HTML DOM in Web scenarios, and easier COM interop. Some of these categories of need might not apply to your particular situation, and that’s okay because there isn’t anything that says that you have to use a language feature just because it’s there. Therefore, I’ll give you an idea of how someone with a specific need might find value in C# 4.0 dynamic programming.

Most C# developers use multiple tools in a single application to accomplish complex tasks. If you’re writing WPF desktop applications, you’re using C# and XAML. It is quite possible that you might find some open source code that solves a problem, but it might be written in another language such as VB or F#. One of the benefits of .NET since its inception is the ability to have cross-language interoperability and the run-time is even called the “Common Language” Runtime (CLR). In recent years, Microsoft has created dynamic languages, such as IronRuby and IronPython, but developers don’t have an easy way to perform interop with dynamic languages. If you have this need, then you’ll welcome the ease with which C# dynamic programming makes interop between C# and dynamic languages possible.

When performing reflection to run a method on an object, there are several hoops to jump through, including obtaining a reference to an object type, getting a reference to a member info object, determining the type of bindings to use, and then invoking the member. While reflection has an undeniable coolness factor, it still feels like a hack and that’s where C# 4.0 dynamic methods can help. Later in this article, I’ll show you how to just call the object member.

If you write Silverlight applications, you might have the need today or in the future to access the HTML DOM containing your Silverlight control. C# dynamic programming makes this task easier.

Performing COM interop with C# has always been cumbersome; partly because of the need to write extra syntax for conversions, optional parameters, and more. This has left some C# developers with a touch of VB envy because VB has easier COM interop support. One of the purposes of dynamic programming in C# is to help the C# programmer write cleaner syntax in COM interop scenarios.

We have spent some time explaining some of the potential benefits of dynamic programming because it’s so new that the value might not jump out at you immediately.

No comments:

Post a Comment

Social Impact