当前位置:网站首页>Partial usage of C #
Partial usage of C #
2022-07-23 11:07:00 【Road of Kings 001】
lately , In use C# Do procedure .
Before making something , Discover the original C# Code ; After watching the , I feel my head is big ; because , The code is too long , Write thousands of lines for a function class , and , It's all written down like this .
The author keeps one principle in mind : Good code , It's not for machines , It's for people . See this phenomenon , I don't feel my head is big .
Just think of a principle : Split thousands of lines of code ; Just right ,C# Provides a partial keyword , It can be done to class、interface Segmentation .
As shown below :
Source file A1.cs
public partial class A
{
public void test1();
}Source file A2.cs
public partial A
{
public void test2();
}Equivalent to a source file A.cs
public class A
{
public void test1();
public void test2();
}Quite understand that some engineers write a lot of functions into a class ; because C# Always an object-oriented language , Same and similar functions , The best way is to write into a class with the same . But a lot of code , Obviously, it does not conform to the principles of simplicity and robustness of code .
But it's sad , Not all languages have this feature , Such as JAVA Language does not have this feature ; The solution is to refine the code .
Yes, of course , at present , Push everyone to refactor and optimize the code together .
边栏推荐
- Redis source code and design analysis -- 6. Compressed list
- 大规模后台导出Excel无法并发
- 防止神经网络过拟合的五种方法
- Notifier Nordic fire engine power supply maintenance and daily maintenance
- Xssgame games (XSS learning) level1-15
- Master slave synchronization step read / write separation + self encountered error sharing
- 村田muRata电源维修交换机服务器电源维修及主要功能特点
- 对比redis的RDB、AOF模式的优缺点
- 6、重心坐标插值和图形渲染管线
- 讲师征集令 | Apache DolphinScheduler Meetup分享嘉宾,期待你的议题和声音!
猜你喜欢

Meyer burger Siemens industrial computer maintenance and machine tool maintenance

Chapter 1 Overview - Section 1 - 1.2 overview of the Internet

单点登录-认证服务器与客户端的session过期时间如何统一

Activiti工作流使用之项目实例

PyTorch(五)——PyTorch进阶训练技巧

Redis source code and design analysis -- 14. Database implementation

9. Ray tracing
![[Anaconda environmental management and package management]](/img/cc/9f15282eabf0eee5e9f28b4f62f1e2.png)
[Anaconda environmental management and package management]

Activiti工作流使用之Activiti-app的安装及流程创建

Cadence learning path (VIII) PCB placement components
随机推荐
十年架构五年生活-02第一份工作
8. Surface geometry
Redis source code and design analysis -- 12. Collection objects
項目部署(簡版)
结构体详解
联合主键和索引
Updated again, idea 2022.2 officially released
Huck hurco industrial computer maintenance winmax CNC machine tool controller maintenance
7、纹理映射
Redis source code and design analysis -- 8. Object system
9. Ray tracing
pygame实现飞机大战游戏
使用cmd安装pygame
Switch exchanges
CountDownLatch的用法
比特,位,字节,字的概念与区别
【ROS进阶篇】第八讲 URDF文件的语法详解
[swift bug] Xcode prompt error running playground: failed to prepare for communication with playground
人脸识别神经网络实现
Mysql事务回滚机制与原理