次のコードがあります。
DateTime dt = (DateTime)rdr["DateFromSQLDB"];
genericclass.classpropertystring = dt.ToShortDateString();
これを1行にまとめるにはどうすればよいですか?
これがクラスです...
public class genericclass
{
public string classpropertystring { get; set; }
}
そのままでもうまく機能しますが、次のようなものを使用できるようにしたいです。
genericclass.classpropertystring = (DateTime)rdr["DateFromSQLDB"].ToShortDateString();
ありがとう!