Which are you intending to create:
A ScriptTask on the Control Panel or,
A ScriptComponent in a Dataflow?
If a ScriptComponent then the Dts reference is not used to access variables. Specify the variable in the components read-only variable list on the property page then reference it ib C# using the this.Variables collection (similar to how you used this.Connections). The defined variables are returned as typed values eg.
string str = Variables.MyStringSSISVariable;