官术网_书友最值得收藏!

Entering the reference code

Now, I'll do my reference code. This code is mechanical. There's a lot of it, but it's mechanical. Remember, the big idea here is that IComparable is being implemented using the CompareTo method inside the Quad class, which means that now when we stick different shapes into a list of quads, we will be able to sort them in some fashion. So, now our names will be sorted. In our case, we'll be sorting them by name.

Now go to Default.aspx, and enter the Design view. Double-click on the Sort and Show button. This takes us into Default.aspx.cs. Delete the Page_Load block.

Next, between the set of curly braces under the line beginning with protected void Button1_Click..., the first thing we'll do is to put a Quad on the left-hand side and we'll call it sqr:

Quad sqr = new Square("Square", 4);
主站蜘蛛池模板: 囊谦县| 长丰县| 阿巴嘎旗| 遵义县| 巴马| 蓬安县| 蕲春县| 浑源县| 卢氏县| 县级市| 池州市| 勐海县| 无为县| 水富县| 二连浩特市| 玉溪市| 登封市| 屏山县| 布拖县| 长治县| 中超| 东宁县| 垦利县| 息烽县| 镶黄旗| 凤阳县| 阆中市| 吉林省| 德阳市| 拉萨市| 大关县| 奉新县| 贵溪市| 高密市| 黎城县| 洪湖市| 滨海县| 辛集市| 紫金县| 襄樊市| 陕西省|