I was browsing a coworkers c# code today and found the following:
using (MemoryStream data1 = new MemoryStream()) using (MemoryStream data2 = new MemoryStream()) { // Lots of code.......... }
I had always seen the using
statement followed by a pair of curly braces that defined the scope of the object life. My coworker who wrote the code said that the curly braces for the data1
using
statement weren't needed and the code did the same thing as if they were present and nested the data2
using
statement. So, what happens when the curly braces are ommitted?
Can-C's ingredients help to soothe and rejuvenate tired eyes, help with macular degeneration, cataracts and other age related eye disorders.
By managing cataracts with Can-C, some patients may be able to avoid cataract surgery and keep their own natural lens. Cataract surgery is an in-office or outpatient procedure done without the need for general anesthetic. The diseased lens is removed and replaced.
Benefits of C-Nac Eye Drop C-Nac Eye Drop adds moisture to your eyes and keeps them lubricated. This gives relief from burning sensation and discomfort due to dryness of the eyes. C-Nac Eye Drop also reduces infection and irritation in the eye.
Use this medication in the affected eye(s) up to 4 times a day as needed or as directed by your doctor. Tilt your head back, look upward, and pull down the lower eyelid to make a pouch. Hold the dropper directly over the eye and place 1 drop into the pouch. Look downward and gently close your eyes for 1 to 2 minutes.
Yes, you can also put them in one using statement:
using (MemoryStream data1 = new MemoryStream(), data2 = new MemoryStream()) { // do stuff }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With