C# Code Analysis CA2000
问题 I have a function which I thought I had fixed the CA2000 warning in Code Analysis for, but it just won't go away. The warning is on SqlCommand. Here's the function: protected internal void LogUserSession(int? managerID) { using (var sqlCommand = new SqlCommand()) { sqlCommand.SetCommand("usp_UserActivity_Create"); SqlParameter prmSessionID = new SqlParameter(); prmSessionID.ParameterName = "@sessionID"; prmSessionID.Direction = ParameterDirection.Input; prmSessionID.SqlDbType = SqlDbType