当前位置:网站首页>C# 1秒跑一个数字的展示,主要练习 事件相关内容
C# 1秒跑一个数字的展示,主要练习 事件相关内容
2022-07-29 12:34:00 【laocooon】
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace EventExample
{
internal class Program
{
static void Main(string[] args)
{
Timer timer = new Timer();//1 拥有者
timer.Interval = 1000;//1秒
Boy boy = new Boy();//3 响应者
//2 事件 Elapsed //4 Action 事件处理器
timer.Elapsed += boy.Action;// 5 订阅
timer.Start();
Console.ReadKey();
}
}
class Boy
{
static int i = 0;
internal void Action(object sender, ElapsedEventArgs e)
{
Console.Write(String.Format($"\r{i++.ToString()}"));
}
}
}
边栏推荐
- TiCDC同步延迟问题处理
- [based] GO language. Why do I have to learn Golang and introduction to the language universal
- npm出现报错 npm WARN config global `--global`, `--local` are deprecated. Use `--location=global
- Mysql各个大版本之间的区别
- How Navicat Connects to MySQL
- Sentinel 2A data preprocessing and calculation of six common vegetation indices in snap software
- 【我的OpenGL学习进阶之旅】向量点乘和叉乘的几何意义
- piglit_get_gl_enum_from_name 参数遍历
- mysql 存储过程详解
- MySQL常用的日期时间函数
猜你喜欢
随机推荐
DVWA全级别通关教程
torch使用总结
MIT指出公开预训练模型不能乱用
pycharm专业版使用
nacos cluster construction
2022年编程语言排名,官方数据来了,让人大开眼界
金仓数据库KingbaseES安全指南--6.8. SSPI身份验证
The strategy pattern replacement if the else
npm出现报错 npm WARN config global `--global`, `--local` are deprecated. Use `--location=global
TiDB 操作实践 -- 备份与恢复
[based] GO language. Why do I have to learn Golang and introduction to the language universal
Container is changed | deploy MySQL cluster in the Rancher
数组及其内存管理三问
[Mysql] LENGTH函数
MySql字符串拆分实现split功能(字段分割转列、转行)
TiFlash 源码阅读(五) DeltaTree 存储引擎设计及实现分析 - Part 2
MLX90640 infrared thermal imaging temperature measuring sensor module development notes (9)
WPF 截图控件之绘制方框与椭圆(四) 「仿微信」
获取list集合中重复的元素
snap软件中哨兵2A数据预处理及六种常用植被指数的计算




![[纯理论] FPN (Feature Pyramid Network)](/img/30/cfb6e3197bc2f4e7e0f1d492976c47.png)




