当前位置:网站首页>C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep271
C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep271
2022-07-03 12:52:00 【superfreak】
using System;
namespace Chapter15InterfaceSampleP271
{
class MyClass :IComparable// Class implementation reference
{
public int TheValue;
public int CompareTo(object obj)// Implementation method
{
MyClass mc=(MyClass)obj;
if (this.TheValue<mc.TheValue) return -1;
if (this.TheValue > mc.TheValue) return 1;
return 0;
}
}
class Program
{
static void PrintOut(string s, MyClass[] mc)
{
Console.Write(s);
foreach (var m in mc)
{
Console.Write("{0}、", m.TheValue);
}
Console.WriteLine("");
}
static void Main(string[] args)
{
var myInt = new[] { 20,4,16,9,2};
MyClass[] mcArr = new MyClass[5];
for (int i = 0; i < 5; i++)
{
mcArr[i] = new MyClass();
mcArr[i].TheValue = myInt[i];
}
PrintOut("Initial Order:",mcArr);
Array.Sort(mcArr);
PrintOut("Sorted Order:", mcArr);
Console.WriteLine("Hello World!");
}
}
}
边栏推荐
- Differences between initial, inherit, unset, revert and all
- 【习题七】【数据库原理】
- 【ArcGIS自定义脚本工具】矢量文件生成扩大矩形面要素
- Openstack node address change
- 剑指Offer06. 从尾到头打印链表
- With pictures and texts, summarize the basic review of C language in detail, so that all kinds of knowledge points are clear at a glance?
- Bert running error: attributeerror: module'tensorflow contrib. tpu' has no attribute 'InputPipelineConfig'
- 十条职场规则
- 01 three solutions to knapsack problem (greedy dynamic programming branch gauge)
- Pytext training times error: typeerror:__ init__ () got an unexpected keyword argument 'serialized_ options'
猜你喜欢
![Sword finger offer04 Search in two-dimensional array [medium]](/img/c4/002c951f8d914aaea4f4133685ebd1.png)
Sword finger offer04 Search in two-dimensional array [medium]

4. Wireless in vivo nano network: electromagnetic propagation model and key points of sensor deployment

Integer case study of packaging

Analysis of the influence of voltage loop on PFC system performance

Two solutions of leetcode101 symmetric binary tree (recursion and iteration)

【ManageEngine】IP地址扫描的作用

(latest version) WiFi distribution multi format + installation framework

Xctf mobile--app3 problem solving

Leetcode234 palindrome linked list

Powerful avatar making artifact wechat applet
随机推荐
剑指Offer07. 重建二叉树
Application of ncnn Neural Network Computing Framework in Orange Pi 3 Lts Development Board
剑指Offer06. 从尾到头打印链表
Cache penetration and bloom filter
Applet wxss introduction
Seven second order ladrc-pll structure design of active disturbance rejection controller
Analysis of the influence of voltage loop on PFC system performance
剑指Offer05. 替换空格
[problem exploration and solution of one or more filters or listeners failing to start]
Tensorflow binary installation & Failure
Gan totem column bridgeless boost PFC (single phase) seven PFC duty cycle feedforward
(latest version) WiFi distribution multi format + installation framework
Record your vulnhub breakthrough record
Using swift language features, write a pseudo-random number generator casually
studio All flavors must now belong to a named flavor dimension. Learn more
Exploration of sqoop1.4.4 native incremental import feature
4. Wireless in vivo nano network: electromagnetic propagation model and key points of sensor deployment
ncnn神经网络计算框架在香橙派OrangePi 3 LTS开发板中的使用介绍
Write a simple nodejs script
Sword finger offer14 the easiest way to cut rope