
C#
ColorPaper
游侠
展开
-
c#时间格式化字符串
有时候我们要对时间进行转换,达到不同的显示效果 默认格式为:2005-6-6 14:33:34 如果要换成成200506,06-2005,2005-6-6或更多的该怎么办呢 我们要用到:DateTime.ToString的方法(String, IFormatProvider) using System; using System.Globalization; Stri转载 2012-08-18 13:41:25 · 717 阅读 · 0 评论 -
C#的abstract关键字
The abstract modifier indicates that the thing being modified has a missing or incomplete implementation. The abstract modifier can be used with classes, methods, properties, indexers, and events. U转载 2012-07-29 18:14:01 · 640 阅读 · 0 评论 -
C#的New关键字和Override关键字对比
Knowing When to Use Override and New Keywords (C# Programming Guide)In C#, a method in a derived class can have the same name as a method in the base class. You can specify how the methods int转载 2012-07-29 13:07:07 · 727 阅读 · 0 评论 -
C#的override关键字
override (C# Reference)The override modifier is required to extend or modify the abstract or virtual implementation of an inherited method, property, indexer, or event.Example转载 2012-07-29 13:05:53 · 706 阅读 · 0 评论 -
C#的Virtual关键字
The virtual keyword is used to modify a method or property declaration, in which case the method or the property is called a virtual member. The implementation of a virtual member can be changed by an转载 2012-07-29 18:08:05 · 707 阅读 · 0 评论 -
C#中的弱引用
Weak ReferencesThe garbage collector cannot collect an object in use by an application while the application's code can reach that object. The application is said to have a strong reference转载 2012-07-29 12:32:56 · 1315 阅读 · 0 评论 -
C#中比较引用类型是否相等
Comparing reference Types for equalityYou might be surprised to learn thatSystem.Objectdefines three different methods for comparing objectsfor equality:ReferenceEquals()and two versions ofEquals(转载 2012-07-28 14:06:47 · 1194 阅读 · 0 评论 -
C#中的typeof关键字
Used to obtain the System.Type object for a type. A typeof expression takes the following form:System.Type type = typeof(int);RemarksTo obtain the ru转载 2012-07-26 23:18:27 · 1308 阅读 · 0 评论 -
BackgroundWorker的使用例子-下载文件
How to: Download a File in the BackgroundThe following code example demonstrates how to use a BackgroundWorker component to load an XML file from a URL. When the user clicks theDownload butt转载 2012-07-26 23:44:59 · 1251 阅读 · 0 评论 -
C#的interface关键字
An interface contains only the signatures of methods, delegates or events. The implementation of the methods is done in the class that implements the interface, as shown in the following example:转载 2012-07-29 18:47:06 · 928 阅读 · 0 评论 -
C#的基本类型的封箱(boxing)与拆箱(unboxing)
boxing and unboxingIn Chapter 2, “Core C#,” you learned that all types, both the simple predefined types such asint andchar,and the complex types such as classes and structs, derive from theob转载 2012-07-28 13:57:34 · 1181 阅读 · 0 评论 -
Nullable Types (C# Programming Guide)
Nullable types are instances of the System.NullableT> struct. A nullable type can represent the correct range of values for its underlying value type, plus an additional null value. For example, a N转载 2012-07-31 20:20:20 · 706 阅读 · 0 评论 -
C#的zip库-notnetzip
DotNetZip - Zip and Unzip in C#, VB, any .NET languageDotNetZip is an easy-to-use, FAST, FREE class library and toolset for manipulating zip files or folders. Zip and Unzip is easy: with DotNetZip,转载 2012-07-31 18:02:39 · 913 阅读 · 0 评论 -
C#的null关键字
The null keyword is a literal that represents a null reference, one that does not refer to any object. null is the default value of reference-type variables. Ordinary value types cannot be null. How转载 2012-07-31 20:24:10 · 615 阅读 · 0 评论 -
在iOS用的.unity3d文件
在unity3d中,unity3d提供了相应的api将Assets导出成一个资源包,然后你在游戏中可以动态加载此资源包,实例化你想要显示的GameObject。注意:这里讲的资源包不是Unity3D Export的 .unitypackage文件,而是后缀为.unity3d文件。.unity3d文件其实是包含了unity3d引擎在运行是能够识别的特殊的资源包,unity3引擎可以动原创 2012-08-10 18:02:51 · 1128 阅读 · 0 评论 -
C#的event关键字
The following example shows how to declare and raise an event that uses EventHandler as the underlying delegate type. For the complete code example that also shows how to use the generic EventHandle转载 2012-07-30 20:02:39 · 656 阅读 · 0 评论 -
C#中的interface
Interfaces (C# Programming Guide)Interfaces are defined using the interface keyword. For example:C#interface IComparable{ int CompareTo(object obj);}转载 2012-07-29 18:56:28 · 819 阅读 · 0 评论 -
Explicit Interface Implementation
If a class implements two interfaces that contain a member with the same signature, then implementing that member on the class will cause both interfaces to use that member as their implementation.转载 2012-07-29 18:49:59 · 534 阅读 · 0 评论 -
C#中实现暂停下载文件和恢复下载文件
Creating an advanced download manager in C#from:http://www.geekpedia.com/tutorial196_Creating-an-advanced-download-manager-in-Csharp.htmlThis is a continuation of the tutorial entitled "转载 2012-07-16 17:43:21 · 1808 阅读 · 0 评论 -
C#的is关键字
Checks if an object is compatible with a given type. For example, it can be determined if an object is compatible with the string type like this:if (obj is string){}转载 2012-07-26 23:13:06 · 799 阅读 · 0 评论 -
C#中RunWorkerCompleted event在哪个线程中触发
问:My C# application has several background workers. Sometimes one background worker will fire off another. When the first background worker completes and the RunWorkerCompleted event is fire转载 2012-07-26 17:05:27 · 2042 阅读 · 0 评论 -
C#中的as关键字
The as operator is used to perform certain types of conversions between compatible reference or nullable types. For example:C# class csrefKeywordsOperators { cl转载 2012-07-26 22:43:00 · 766 阅读 · 0 评论 -
Platform Invoke Tutorial
Platform Invocation Services (PInvoke) allows managed code to call unmanaged functions that are implemented in a DLL.This tutorial shows you what you need to do to be able to call unmanaged DLL func转载 2012-08-05 09:48:55 · 694 阅读 · 0 评论 -
C#中的代理
from:http://msdn.microsoft.com/en-us/library/ms173172(v=vs.80).aspxA delegate is a type that safely encapsulates a method, similar to a function pointer in C and C++. Unlike C function point转载 2012-07-19 10:55:06 · 658 阅读 · 0 评论 -
ADO.NET摘要1
DataSet vs. DataReaderTo determine whether to use the DataSet or the DataReader when you design your application, consider the level of functionality that is needed in the application.Use the Data转载 2012-08-01 20:37:49 · 703 阅读 · 0 评论 -
Tips From MonoSQLite
Here are some hints and tips we have been collecting along the way to make your (and our) lives better.First, we’d like to list some of the SQLite browsers we already know and let me tell you, it is转载 2012-08-02 19:30:59 · 684 阅读 · 0 评论 -
HttpWebRequest.AddRange Method (Int32)
public void AddRange( int range)RemarksThe HttpWebRequest.AddRange method adds a byte range header to the request.If range is positive, the range parameter specifies the st转载 2012-07-16 17:44:59 · 800 阅读 · 0 评论 -
C#如何调用linux so库
//testlib.c中的内容:#includeint sum(int a,int b){ return a + b;}int minus(int a,int b){ return a - b;}//main.cs中的内容:using System;using System.Runtime.In转载 2012-06-21 10:09:39 · 10768 阅读 · 3 评论 -
Threading Tutorial
The advantage of threading is the ability to create applications that use more than one thread of execution. For example, a process can have a user interface thread that manages interactions with the转载 2012-06-11 17:43:09 · 552 阅读 · 0 评论 -
Threading Tutorial
from:http://msdn.microsoft.com/en-us/library/aa645740(v=vs.71).aspxThreading TutorialVisual Studio .NET 2003235 out of 356 rated this helpful - Rate this topicThe a转载 2012-06-08 09:19:15 · 564 阅读 · 0 评论 -
C#的Attribute
from: http://www.codeproject.com/Articles/1811/Creating-and-Using-Attributes-in-your-NET-applicatDownload the source code (2 KB)Download the demo executable (2 KB)Table of Cont转载 2012-08-05 10:56:04 · 869 阅读 · 0 评论 -
与C#相关的XML Documentation
from: http://msdn.microsoft.com/en-us/library/b2s063f7(v=vs.71)In Visual C# you can document the code you write using XML. C# is the only programming language in Visual Studio .NET with this转载 2012-08-05 13:34:32 · 787 阅读 · 0 评论 -
C#中如何判断当前线程是否为主线程
C#中如何判断当前线程是否为主线程/ Do this when you start your applicationstatic int mainThreadId;// In Main method:mainThreadId = System.Threading.Thread.CurrentThread.ManagedThreadId;// If called转载 2012-07-26 17:03:34 · 4034 阅读 · 0 评论 -
如何在unity3D的C#中调用libsqlite3(完整代码)
在unity中尝试使用sqlite,本打算用Mono.Data.Sqlite,但发现Mono.Data.Sqlite有bug,把unity 项目导出成iOS项目,编译后,运行程序就挂了,只好自己在C#直接调用底层的libsqlite3库。using UnityEngine;using System.Runtime.InteropServices;using Syst原创 2012-08-06 18:24:59 · 2977 阅读 · 0 评论 -
C#中让副线程跟主线程交互的类-BackgroundWorker
BackgroundWorker Class.NET Framework 4Other Versions20 out of 27 rated this helpful - Rate this topicUpdated: September 2010Executes an operatio转载 2012-07-26 15:43:33 · 1139 阅读 · 0 评论 -
Marshal UTF8 Strings in .NET
Marshal UTF8 Strings in .NETWow, what a pain in the butt. .NET strings are stored internally as UTF16, not UTF8, so if you're marshaling strings to and from a library that wants strings as UTF转载 2012-08-08 14:56:42 · 1587 阅读 · 0 评论 -
在C#中使用SharpZipLib压缩解压缩zip文件
from:http://skysanders.net/subtext/archive/2010/05/23/sharpziplib-recursively-zip-directory-structure.aspxSharpZipLib: recursively zip/unzip directory structure001// Pr转载 2012-08-09 12:01:20 · 1524 阅读 · 0 评论 -
IntPtr和string的相互转化
Marsha有三个方法将string转为IntPtr: Copies the contents of a managed String into unmanaged memory, converting into ANSI format if required.public static IntPtr StringToHGlobalAuto(string s) public s转载 2012-08-08 20:44:47 · 6076 阅读 · 0 评论 -
C#学习
如何学习一门编程语言:程序入口基本数据类型:整型 浮点型 字符类型 字符串类型 数据结构 枚举类型 数组if 循环 switch语句继承 封装 多态 接口 抽象类 虚方法常用的类:集合类(List和Dictionay)IO类型:Stream File内存管理异常处理机制线程网络编程CLR common langu转载 2012-08-03 23:08:47 · 545 阅读 · 0 评论 -
在C#中如何调用libsqlite3中的返回值为char *的函数
之前写了在C#中调用libsqlite3中函数的一些代码:[DllImport("sqlite3.dll")] private extern staticstring sqlite3_column_text(IntPtr pStmt, int iCol); [DllImport("sqlite3.dll")] privatee xtern static stri原创 2012-08-08 14:53:35 · 1210 阅读 · 0 评论