
c#
nchangyu
这个作者很懒,什么都没留下…
展开
-
桥接模式
public interface DrawAPI { void drawCircle(int radius, int x, int y); } public class RedCircle : DrawAPI { public void drawCircle(int radius, int x, int y) { Report.Info...原创 2020-04-22 17:24:14 · 154 阅读 · 0 评论 -
C#学习记录3
public class Std { public int Inum; public string strName; ArrayList Iage = new ArrayList(); public void getvalue(int num, string Name, int[] age) { ...原创 2019-12-15 21:27:01 · 92 阅读 · 0 评论 -
建造者模式
/// <summary> /// 食物条目 /// </summary> public interface Item { string name(); Packing packing(); float Price(); } public interface Packing{ string pack(); }...原创 2019-12-13 15:18:14 · 108 阅读 · 0 评论 -
单例模式
饿汉式 优点:没有加锁,执行效率会提高。 缺点:类加载时就初始化,浪费内存。 public class SingletonPattern { public static SingletonPattern Instance=new SingletonPattern(); private SingletonPattern(){} pub...原创 2019-12-12 11:35:36 · 85 阅读 · 0 评论 -
适配器模式
/// <summary> /// 创建接口 /// </summary> public interface MediaPlayer { void Player(string audioType,string Filename); } public interface AdvancedMediaPlayer { void PlayerMP...原创 2019-12-12 10:41:35 · 88 阅读 · 0 评论 -
抽象工厂模式
//创建一个接口 public interface Shape { void draw(); } public interface Color { void fill(); } //创建实现接口的实体类 public class Rectangle :Shape { //@override public void draw(){ Report....原创 2019-12-10 14:22:42 · 96 阅读 · 0 评论 -
工厂模式
//创建一个接口 public interface Shape { void draw(); } //创建实现接口的实体类 public class Rectangle :Shape { //@override public void draw(){ Report.Info("Square::shape().menthod"); } } pub...原创 2019-12-10 10:56:37 · 114 阅读 · 0 评论 -
C#学习记录2
int r=repo.MainWnd_PMS_AzSoft.ctrl_DrawViewWindow.ScreenRectangle.Top; int e=repo.MainWnd_PMS_AzSoft.ctrl_DrawViewWindow.ScreenRectangle.Bottom; int d=repo.MainWnd_PMS_AzSoft.ctrl_DrawViewWi...原创 2019-02-27 17:06:03 · 172 阅读 · 0 评论 -
剪贴板数据操作
1、 从系统剪切板获取数据GetDataFromClipboard(){ try{ WinForms.IDataObject data = WinForms.Clipboard.GetDataObject(); if(data.GetDataPresent(WinForms.DataFormats.Uni...原创 2019-11-14 10:55:05 · 719 阅读 · 0 评论 -
C#学习记录1
1、文件夹遍历并获取匹配文件名 public static void ErrorAnalysisTable(string path){ DirectoryInfo root=new DirectoryInfo(path); // //判断路径下误差分析表并输出表名 foreach (FileInfo f in root.GetFiles()){ ...原创 2019-09-19 18:13:33 · 170 阅读 · 0 评论 -
继承、多继承
基类和派生类 c#Rectangle rect =new Rectangle();rect.SetWidth(5);rect.SetHeight(7);Report.Info("矩形面积:"+rect.getArea()); class shape{ public void SetWidth(int W){ Width=W; } p...原创 2019-07-24 15:07:12 · 127 阅读 · 0 评论 -
Match、IsMatch
1、Match:返回的是包含匹配信息的Match对象。 Study("桥架多回路布线自动生成"); public static void Study(string b){ string[] a=new string[]{"多回路布线","预留洞"}; for(int i=0;i<a.Length;i++){ ...原创 2019-06-11 17:36:23 · 1371 阅读 · 0 评论 -
IndexOf、LastIndexOf、Substring、IndexOfAny纯记录
1、 IndexOf Study("全部匹配"); public static void Study(string b){ string[] a=new string[]{"匹配","一样"}; for(int i=0;i<a.Length;i++){ if(b.IndexOf(a[i],2,2)...原创 2019-06-11 15:33:30 · 148 阅读 · 0 评论 -
C#简单判空
Nullable<int> a =new System.Nullable<int>(10); Report.Info("传入参数类型 "+a.GetType()); //传入参数类型 System.Int32 Report.Info("传入参数 "+a); //传入参数 10...原创 2019-05-07 14:25:08 · 2640 阅读 · 1 评论 -
二维数组、锯齿数组
1、二维数组string[,] strClickZB=new string[,]{{"0,9000","9000,9000","9000,6000","6000,3000"}, {"3000,12000","3000,6000","",""}, {"6000,9000","60...原创 2019-04-11 14:44:21 · 385 阅读 · 0 评论 -
Clone()
public class StudyClass{ public static PMS_SuanLiangRepository repo = PMS_SuanLiangRepository.Instance; public int _age; public string _Name; public StudyCl...原创 2019-03-15 15:23:51 · 177 阅读 · 0 评论