C#的题目 高手进

来源:百度知道 编辑:UC知道 时间:2024/05/06 09:49:53
1, 使用SqlConnection,SqlCommand,SqlDataReader和SqlParameter,写一个方法从数据库中读数据。
2, 定义一个泛型集合类。要求:实现Ienumerable<T>接口,T是值类型,并T取2个类型分别测试。
3,在Graphics绘图面中心绘制一个1/4大小的红色矩形,在矩形内中心位置填充一个适当大小的蓝色椭圆,在椭圆内中心位置写上红色文字“我的绘图画”,并在矩形的4个角各绘制一个蓝色小圆。

我靠!你这是什么问题 跳来跳去的什么都有
1.
public static SqlDataReader GetReader(string sql, SqlParameter param)
{
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(sql, connection);
cmd.Parameters.Add(param);
try
{
connection.Open();
SqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
return myReader;
}
catch (System.Data.SqlClient.SqlException e)
{
throw new Exception(e.Message);
}
}
2.
List<int> list = new List<int>();
list.Add(1);
list.Add(2);
List<float> list = new List<float>();
list.Add(1.0f);
list.Add(2.0f);
3.
Graphics g = this.CreateGraphics();
g.FillRectangle(Brushes.Red,new Rectangle(this.Width / 2 - this.Width / 8,this.Height / 2 - this. Height / 8,this.Width / 4, this.Height / 4));

g.FillEllipse(Brushes.Blue,t