Tengo el siguiente código el cual estoy tratando de hacer uso de tuple para devolver 2 valores pero me arroja un error al momento de poner el return.
public Tuple<DateTime,DateTime> Obtener_Fecha_Acceso_Sin_Label_Fec(DateTime dtpFecIni,DateTime dtpFecFin)
{
string sql = @"SELECT ID,FechaInicio,FechaFin from TBL_FECHA_PROCESO ";
string connstring = ConfigurationManager.ConnectionStrings["Trabajo"].ToString();
using (SqlConnection conn = new SqlConnection(connstring))
{
SqlCommand command = new SqlCommand(sql, conn);
try
{
conn.Open();
SqlDataReader buscar = command.ExecuteReader();
if (buscar.Read() == true)
{
dtpFecIni = Convert.ToDateTime(buscar["FechaInicio"]);
dtpFecFin = Convert.ToDateTime(buscar["FechaFin"]);
}
else
{
MessageBox.Show("Registro No Fue Encontrado", "SISROL", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//txtid.Text = "";
//txtid.Focus();
}
}
catch (SqlException ex)
{
MessageBox.Show("ERROR: " + ex.Message, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(-1);
}
finally
{
if (command != null)
{
((IDisposable)command).Dispose();
}
//if (conn != null)
//{
// ((IDisposable)conn).Dispose();
//}
}
}
return (dtpFecIni, dtpFecFin); -- AQUI MUESTRA ERROR
Como se ve en el codigo señalo donde se produce el error y aqui pongo el detalle del mismo.
Error CS0029 No se puede convertir implícitamente el tipo '(System.DateTime dtpFecIni, System.DateTime dtpFecFin)' en 'System.Tuple<System.DateTime, System.DateTime>'
De antemano agradezco su ayuda guiandome sobre mi error.