Variant data type within Integration Studio (.Net related)

Variant data type within Integration Studio (.Net related)

  
Hi guys,

So I've seen a few extensions where some of the code makes use of variants var foo = "bar" vs string foo = "bar". When I download these extensions, I'm getting compile errors when I publish, pointing specifically at the lines of code that contain variants. It's easy enough to change these types, but is there something in my configuration I have wrong in order to allow variants to compile? I would love to have that capability in .Net when publishing extensions.

Thanks!
Hello Isaac,

That particular construct is not available in .NET 2.0, but is a part of .NET 3.5.

Usually the problem with this is in extension upgrades or the like where the project file is set to use ToolsVersion=2.0. You can usually overcome this by opening the extension project file and looking for the attribute ToolsVersion and setting it to 3.5 . 

You should also be using the .NET framework 3.5 compiler.

I know there is a post around here somewhere by João Rosado which explains this process with screenshots, but today I'm too lazy to look for it :)
I think the 3.5 command line for the compiler should be the default, this is the #1 most asked question on the forum, I think.

J.Ja
Thanks Ricardo. I found the link:

http://www.outsystems.com/forums/discussion/8501/tip-extensions-using-net-3-5-fail-compilation-in-integration-studio/

Justin, I agree that 3.5 should be the default compiler for integration studio. I wonder why it isn't? Regression issues?
Hello,

Just a quick note. The construct var foo = "bar" is not related to the variants like you said. This is exactly the same as string foo = "bar", the compiler simply infers the type so you don't have to write it. It doesn't have anything to do with the variants or not, everything is always strongly typed. This appeared in C# 3.0, its nothing related to the .NET framework since its simply sintatic sugar.

Please see folowing articles for a information on the var keyword:
http://msdn.microsoft.com/en-us/library/bb383973.aspx
http://msdn.microsoft.com/en-us/library/bb384061.aspx

Best Regards,
Rui Eugénio

Thanks Rui, you are correct. The question was poorly worded, but apparently understood by all who responded, so the goal was achieved as my problem was resolved.

In truth, the (non) variants are used as syntactic sugar partly because it makes it easier for a lazy developer (such as myself) to write extended LINQ queries, while still in design mode, and unsure of what I might get back, a single record, a scalar value, a List, etc... I hated having to go back and retrofit my declared types so I loved the feature.

Cheers!
Yeah, no problem, I just wrote the post because I thought that you didn't known the diference.
But it seems I was wrong since not only you already knew but also stated the reasons why the var keyword is such a useful keyword...

Happy coding,
Rui Eugénio