title: Add string array to SQL query
body: <p>I have a string array which consists of identifiers. I want to get some values from SQL using these identifiers . Is there a way of adding them with a string value to <code>SqlCommand</code> parameters?</p>
  
  <p>I want to create a query like: </p>
  
  <pre><code>select CaseList from MasterReportData where Id = 1 OR Id = 2 OR Id = 3
  </code></pre>
  
  <p>This is my C# code:</p>
  
  <pre><code>public static List&lt;string&gt; GetCaseList(string[] masterIdList)
      {
  
          try
          {
              string query = "  select CaseList from MasterReportData where @masterId";
              SqlConnection conn = new SqlConnection(connString);
              SqlCommand cmd = new SqlCommand(query, conn);
              cmd.Parameters.AddWithValue("masterId", ***);
              conn.Open();
              using (SqlDataReader reader = cmd.ExecuteReader())
              {
                  while (reader.Read())
                  {
                      list.Add(reader[0].ToString());
                  }
              }
              conn.Close();
          }
          catch (Exception e)
          {
              var err= 0;
          }
          return list;
      }
  </code></pre>