- 1

what is name this the operation in c#

using(){}

10th Jun 2017, 5:54 PM
ALAMOUDI, WAEL MAKKI S
ALAMOUDI, WAEL MAKKI S - avatar
3 odpowiedzi
+ 1
Please give some more information. What do you want to know ?
10th Jun 2017, 6:31 PM
sneeze
sneeze - avatar
+ 1
Using defines the scope that the object between () is available. This is usefull with big objects that require a lot of memory or objects that have connections with other resources (files / databases) and you want to make sure it is disposed properly. So MD5CryptoServiceProvider is created, can be used between the {} and is disposed The reason for the "using" statement is to ensure that the object is disposed as soon as it goes out of scope https://stackoverflow.com/questions/75401/uses-of-using-in-c-sharp
10th Jun 2017, 9:00 PM
sneeze
sneeze - avatar
0
look static string En (string value ) { using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider()) { UTF8Encoding ut = new UTF8Encoding(); byte[] data = md5.ComputeHash(ut.GetBytes(value)); return Convert.ToBase64String(data); } } what is the using (){ }
10th Jun 2017, 8:08 PM
ALAMOUDI, WAEL MAKKI S
ALAMOUDI, WAEL MAKKI S - avatar