Which code segment should you use?
A. string instanceName = Assembly.GetEntryAssembly().FullName;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfReclaimedConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue();
B. string instanceName = Assembly.GetEntryAssembly().GetName().Name;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfReclaimedConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue();
C. string instanceName = Assembly.GetEntryAssembly().FullName;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfNonPooledConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue();
D. string instanceName = Assembly.GetEntryAssembly().GetName().Name;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfNonPooledConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue();
Answer:A
Which code segment should you use?
A. string instanceName = Assembly.GetEntryAssembly().FullName;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfReclaimedConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue(); B. string instanceName = Assembly.GetEntryAssembly().GetName().Name;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfReclaimedConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue(); C. string instanceName = Assembly.GetEntryAssembly().FullName;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfNonPooledConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue(); D. string instanceName = Assembly.GetEntryAssembly().GetName().Name;PerformanceCounter perf = new PerformanceCounter(“.NET Data Provider for SqlServer”,”NumberOfNonPooledConnections”, instanceName, true);int leakedConnections = (int)perf.NextValue();