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

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);
主站蜘蛛池模板: 东兰县| 北川| 南雄市| 普定县| 米脂县| 韩城市| 德格县| 思茅市| 湘阴县| 新建县| 内江市| 曲阳县| 通许县| 治多县| 吉首市| 密云县| 章丘市| 峨眉山市| 宝兴县| 宜都市| 岑巩县| 金山区| 兴化市| 岳阳县| 罗田县| 故城县| 任丘市| 龙江县| 凤城市| 宜兴市| 新沂市| 九台市| 和林格尔县| 上杭县| 柘城县| 丰城市| 黑河市| 嫩江县| 韩城市| 扎鲁特旗| 鸡泽县|