class _Explain
{
public int ID { get; set; }
public string SelectType { get; set; }
public string Table { get; set; }
public string Type { get; set; }
public string PossibleKeys { get; set; }
public string Key { get; set; }
public int KeyLen {get; set;}
public string Ref { get; set; }
public int Rows { get; set; }
public string Extra { get; set; }
}
...
using (MySqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
expList.Add(new _Explain
{
ID = Convert.ToInt32(rdr["id"]),
SelectType = rdr["select_type"].ToString(),
Table = rdr["table"].ToString(),
Type = rdr["type"].ToString(),
PossibleKeys = rdr["possible_keys"].ToString(),
Key = rdr["key"].ToString(),
KeyLen = Convert.ToInt32(rdr["key_len"]),
Ref = rdr["ref"].ToString(),
Rows = Convert.ToInt32(rdr["rows"]),
Extra = rdr["Extra"].ToString()
});
var nullableValue = (rdr["type"] is DBNull) ? null : rdr["type"].ToString();