I am working on a SSIS job which has a script task in VB.Net. Our organizational directive is to move towards C# in the long run. For a new SSIS job I am developing, I used an online VB.Net to C# converter and using it in a scrip task. The VB.Net statement that reads a variable has similar syntax in C#, but throwing an error message. Below is the VB.Net and the equivalent C# code.
VB.Net statement:
Dim strEnvironment As String = Dts.Variables.Item("g_Environment").Value.ToString()
C# statement:
String strEnvironment = Dts.Variables.Item("g_Environment").Value.ToString()
As you can see, the statement to store a value in a variable is same between VB.Net and C#. However, when I use this code in the script task of SSIS job, the C# code is flagging the below error message.
'Variables' does not contain a definition of 'Item' and no accessible extension method 'Item' accepting a first argument of type 'Variables' could be found (Are you missing a using directive or an assembly reference?).
My import statements have the following:
Using System;
Using System.IO;
Using System.text;
Using Sytsem.Collections;
Using System.Data;
Using Microsoft.Visualbasic;
Using Microsoft.SqlServer.Dts.Runtime;
I am completely new to SSIS/VB.Net and C#. Can someone help?

Dim strEnvironment as Stringin VB instead ofString strEnvironment.Dts.Variables["g_Environment"]