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

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);
主站蜘蛛池模板: 休宁县| 莎车县| 甘泉县| 双峰县| 乐都县| 金坛市| 建阳市| 淅川县| 平顶山市| 都江堰市| 尚义县| 安平县| 台南市| 泸水县| 贺兰县| 延安市| 英德市| 永丰县| 邯郸县| 全州县| 邵武市| 临高县| 五河县| 阿荣旗| 宁陕县| 大丰市| 杭锦旗| 毕节市| 红桥区| 黄冈市| 东乌珠穆沁旗| 民和| 儋州市| 鄂托克前旗| 安宁市| 遵化市| 米林县| 新巴尔虎右旗| 眉山市| 浮山县| 乌拉特中旗|