© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
15 replies
hutonahill

✅ using

I keep seeing variables defined within a using, like
using(var connection = new SQLiteConnection()){
...
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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ USING
C#CC# / help
4y ago
❔ Using Selenium
C#CC# / help
3y ago