
C#
小可_子衿
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
c#_格式化输出
class Program { static void Main(string[] args) { Console.WriteLine("数字格式化输出"); formateNumericalValue(99999); Console.ReadKey(); }原创 2015-06-28 16:33:39 · 808 阅读 · 0 评论 -
C#_使用LitJson解析Json
class Skill { public int id; public string name; public string desc; public override string ToString() { return string.Format("id:{0}, name:{1}原创 2015-12-19 23:03:32 · 954 阅读 · 0 评论 -
C#_FileInfo文件属性类和DirectoryInfo文件夹属性类
using System;using System.Collections;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using LitJson;namespace CShapeTest{ class Start { st原创 2015-12-19 23:37:39 · 6273 阅读 · 0 评论 -
C#_File文件读取和写入
using System;using System.Collections;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using LitJson;namespace CShapeTest{ class Start { st原创 2015-12-19 23:54:20 · 3880 阅读 · 0 评论 -
C#_FileStream读取文本文件和二进制文件
using System;using System.Collections;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using LitJson;namespace CShapeTest{ class Start { st原创 2015-12-20 13:05:52 · 15508 阅读 · 0 评论 -
C#_StreamReader读取文本文件
using System;using System.Collections;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;namespace CShapeTest{ class Start { static void Main(原创 2015-12-20 13:29:19 · 5380 阅读 · 0 评论 -
C#_委托的使用
// 委托其实就是一种数据类型 delegate void behaviourDelegate(); class Person { public void bahaviourFunc(behaviourDelegate del) { if (del != null) {原创 2015-12-12 19:14:59 · 309 阅读 · 0 评论 -
C#_格式化输入日期时间
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace CShapeTest{ class Start { static void Main(string[] args原创 2015-12-03 22:58:44 · 859 阅读 · 0 评论 -
C#_位操作
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace CShapeTest{ class Start { static void Main(string[] args原创 2015-12-03 22:51:40 · 423 阅读 · 0 评论 -
C#_is运算符,new运算符,typeof运算符
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace CShapeTest{ class Start { static void Main(string[] args原创 2015-12-03 22:53:37 · 579 阅读 · 0 评论 -
C#_字符串拆分Split实例方法
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace CShapeTest{ class Start { static void Main(string[] args原创 2015-12-03 23:03:00 · 874 阅读 · 0 评论 -
C#_字符串中的Compare和Equal方法
在C#的字符串操作中,有静态的Compare方法和实例的Compare方法,而Equal是静态方法using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace CShapeTest{ class原创 2015-12-03 22:57:35 · 3248 阅读 · 0 评论 -
C#_字符串截取Substring实例方法
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace CShapeTest{ class Start { static void Main(string[] args原创 2015-12-03 23:00:27 · 682 阅读 · 0 评论 -
C#_LINQ数据查询
using System;using System.Collections;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;namespace CShapeTest{ class Master { public int Id {原创 2015-12-22 22:34:58 · 627 阅读 · 0 评论 -
C#_IEnumerable和IEnumerable<T>
using System;using System.Collections;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;namespace CShapeTest{ // 实现非泛型IEnumerable可枚举接口 class Teacher:原创 2015-12-22 22:58:46 · 3474 阅读 · 0 评论 -
C#_Dictionary<TKey, TValue>的使用
class Person { private int age; private string name; public Person(int age, string name) { this.age = age; this.name = name; }原创 2015-12-27 13:04:14 · 1357 阅读 · 0 评论 -
C#_List<T>的使用
class Person { private int age; private string name; public Person(int age, string name) { this.age = age; this.name = name; }原创 2015-12-27 12:51:48 · 473 阅读 · 0 评论 -
C#_密封类和密封方法
// 密封类,子类不能继承父类 public sealed class Person { private string name; private int age; // 密封方法,子类不能重写或者覆盖改方法 public sealed void sayHello() { Co原创 2015-12-16 18:08:05 · 584 阅读 · 0 评论 -
C#_Socket的TCP使用
namespace TCPClient{ class TCPClient { static void Main(string[] args) { // 客户端Socket // 初始化Socket Socket tcpClient = new Socket(AddressFam原创 2015-12-16 23:43:31 · 479 阅读 · 0 评论 -
C#_C#中的事件
自定义事件:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace _118_SealedUserInfo{ class Program { public stat原创 2015-09-05 11:28:39 · 385 阅读 · 0 评论 -
C#_C#中[],List,Array,ArrayList的区别及应用
[] 是针对特定类型、固定长度的。List 是针对特定类型、任意长度的。Array 是针对任意类型、固定长度的。ArrayList 是针对任意类型、任意长度的。Array 和 ArrayList 是通过存储 object 实现任意类型的,所以使用时要转换。using System; using System.Collections.Generi原创 2015-09-02 15:01:26 · 505 阅读 · 0 评论 -
C#_HashTable和SortedList的使用方法
// 无序的键值表(以键的顺序来排列) Hashtable hashTable = new Hashtable(); hashTable["a"] = 1; hashTable["b"] = 2; hashTable["c"] = 3; hashTable["d"] = 4;原创 2015-12-12 17:17:34 · 1279 阅读 · 0 评论 -
C#_事件的使用
class Person { // 委托如果是public修饰,就可以在类的外部调用 public delegate void behaviourDelegate();// 委托 // 事件只能在定义该事件的类的内部调用,不管是public修饰,还是private修饰,都只能在类的内部调用 public event behav原创 2015-12-12 20:37:42 · 495 阅读 · 0 评论 -
C#_Queue的使用方法
// Queue存放的数据类型是Object类型,所以可以同时存放整形和字符串 Queue queue = new Queue(); queue.Enqueue(1); queue.Enqueue(2); queue.Enqueue(3); queue.Enqueue(4);原创 2015-12-12 16:52:03 · 3621 阅读 · 0 评论 -
C#_异常捕捉
static void Main(string[] args) { // 捕捉异常,捕捉异常的代码结构,必须在try后面,可以只加catch或者只加finally,或者catch和finally都添加,但是不能2个都不添加 // 同时在catch和finally代码块是获取不到try代码块的变量的 try原创 2015-12-12 21:17:33 · 690 阅读 · 0 评论 -
C#_垃圾回收
// 第一种方式:实现IDisposable接口,自己释放资源 class Person : IDisposable { private bool isDisposed = false; // 这里是真正的释放资源 protected virtual void Dispose(bool disposing) {原创 2015-12-12 21:30:40 · 359 阅读 · 0 评论 -
C#_Http(Get/Post)
using System;using System.Collections;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net;using System.Text;namespace CShapeTest{ class Start {原创 2015-12-27 22:45:10 · 415 阅读 · 0 评论 -
C#_ArrayList的使用方法
// ArrayList存放的数据类型是Object类型,所以可以同时存放整形和字符串 ArrayList arrList = new ArrayList(); arrList.Add(1); arrList.Add(2); arrList.Add(3); arrList.Add原创 2015-12-12 16:38:56 · 559 阅读 · 0 评论 -
C#_Stack的使用方法
// Stack存放的数据类型是Object类型,所以可以同时存放整形和字符串 Stack stack = new Stack(); stack.Push(1); stack.Push(2); stack.Push(3); stack.Push(4);原创 2015-12-12 17:03:52 · 2966 阅读 · 0 评论 -
C#_可变长参数列表的使用
static void Main(string[] args) { func(1, 2, 3); func1(1, 2, 3, "cxm"); Console.ReadLine(); } // 可变长参数列表特例1 private static void fu原创 2015-12-12 17:30:36 · 4551 阅读 · 0 评论 -
C#_属性的封装(get和set)
class Person { private int x; private int y; public int X { get { return this.x; } set原创 2015-12-12 18:17:11 · 2514 阅读 · 0 评论 -
C#_索引器的使用
class Person { // C#中的索引器一般是为了操作内部的数组方便而设计 private String[] name = new String[10]; public String this[int index] { get { re原创 2015-12-12 18:40:11 · 343 阅读 · 0 评论 -
C#_实现闭包函数
delegate void ActionCallback(); class Start { static void Main(string[] args) { for (int i = 0; i < 5; i ++ ) { // 分析:编译器将闭包引用的局部变量转换为匿原创 2015-12-15 22:16:47 · 503 阅读 · 0 评论 -
C#_序列化
(1).NET支持对象序列化的几种方式二进制序列化:对象序列化之后是二进制形式的,通过BinaryFormatter类来实现的,这个类位于System.Runtime.Serialization.Formatters.Binary命名空间下。SOAP序列化:对象序列化之后的结果符合SOAP协议,也就是可以通过SOAP 协议传输,通过System.Runtime.Serialization.原创 2015-12-15 23:50:16 · 364 阅读 · 0 评论 -
C#_抽象类和抽象方法
// 抽象类必须使用abstract来修饰 public abstract class Person { // 抽象方法必须使用abstract来修饰,不能使用virtual或者static修饰 public abstract void sayHello(); } public class Student : Person原创 2015-12-16 18:53:05 · 801 阅读 · 0 评论 -
C#_List<T>升序排序和降序排序
using System;using System.Collections;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;namespace CShapeTest{ class Hero { private int age;原创 2015-12-27 15:06:53 · 15322 阅读 · 0 评论