Hello everyone I am fairly new to C# and programming. I'm learning some bits and bytes about good practices when it comes to programming and declaring variables. I'm developing a POS system in C# and I need some help in understanding the practices in declaring variables to move forward.
My question is does C# have global variables? Where is it safe to declare variables in c#? below is a small program I'm experimenting and though if this is a good programming practice although this works perfectly fine.
private class SetDatObjects {
        public SqlConnection connection = new SqlConnection();
        public SqlCommand command = new SqlCommand();
        public SqlDataAdapter adapter = new SqlDataAdapter();
        public SqlCommandBuilder commandBuilder = new SqlCommandBuilder();
        DataSet dataset = new DataSet();
    }
private void DataGridViewBinding()
    {
        SetDatObjects SDO = new SetDatObjects();
        SDO.connection.ConnectionString = @"Data Source=imadh\imadh;Initial Catalog=ITZone;Integrated Security=True";
    }
Thank you for answers.... Much appreciated
