C#C
C#17mo ago
hutonahill

✅ using

I keep seeing variables defined within a using, like
using(var connection = new SQLiteConnection()){
...


what is using? why do people use it? what are the risks of not using it?

I think this just disposes of the connection variable (for sure) after its done, but i see it used mostly when dealing with databases. is there a reason for this. If my variables are within a method they get disposed at the end of the method right? How concerned should i be about this?
Was this page helpful?