. Net programmers

Source: Internet
Author: User

System Type

Type, Object, String, Arrary, Console, Exception, GC, MarshalByRefObject, and Math.

DateTime structure, Guid structure,

ICloneable interface, IComparable interface, IConvertible interface, IDisposable class,

Collection class

ICollection interface, IComparer interface, and IDictionary interface. IDictionaryEnumerator interface, IEnumerable interface,

IEnumerator interface, IHashCodeProvider interface, IList interface,

Stack class, Queue class ArraryList class, Hashtable class, SortedList class CollectionBase class, DictionBase class

The DictionEntry structure.

Input and Output

Byte stream

Stream, BufferedStream, FileStream, and MemorStream

Binary I/O Stream

BinaryReader and BinaryWriter.

Character I/O Stream

TextReader, TextWriter, StreamReader, StreamWriter, StringReader, StringReader, and StringWriter.

I/O Enumeration

FileAccess enumeration, FileAttributes enumeration, FileMode enumeration, and FileShare enumeration.

Class libraries are the basis for our learning and development. I listed some common classes and got comments from many netizens. For better system learning.

I plan to write a series of summaries. I hope it will be helpful to new users.

The following are common classes of the system namespace:

Basic Object and Type class, which forms the basis of the. NET FrameWork function.

Multi-purpose class. Such as Array, Console, and String, they are used for many different types of applications.

Important Base classes, such as EventArgs, Exception, and externalbyrefobject. These classes define the common property feasibility methods of many derived classes.

Math class, which is a library containing only mathematical functions and constants.

Convert class, which provides conversion functions.

Generally, generic classes are defined as static classes. In this way, the entire sentence is called.

Type

Type indicates the Type declaration: class Type, interface Type, array Type, value Type, enumeration Type, Type parameter, generic Type definition, and open or closed generic Type.

A library that contains only mathematical functions and constants.

You can obtain a Type object in two ways, one using the GetType () method, or the other using the typeOf operator. The following statement provides a Type object that represents the String class.

 

Type type1 = Type. GetType ("System. String ");
Type type2 = typeof (string );

 

The following is a simple example code: using System;
Using System. Reflection;

Class Example
{
Static void Main ()
{
Type t = typeof (String );

MethodInfo substr = t. GetMethod ("Substring ",
New Type [] {typeof (int), typeof (int )});

Mp; nbsp; Object result =
Substr. Invoke ("Hello, World! ", New Object [] {7, 5 });
Console. WriteLine ("{0} returned \" {1} \ ".", substr, result );
}
}

/* This code example produces the following output:

System. String Substring (Int32, Int32) returned "World ".
*/

 

Object Class

Is the final parent class of all classes in. NET FrameWork. It provides a general method for all other classes.

Because all other classes are derived from objects, Object Inheritance does not need to be declared with the Declaration.

The keyword object is provided in the C # language. It can be used as an alias for the Object class. You can use it in any expression that requires an Object.

Main Method

Equals () determines whether two Object instances are equal.

Finalize () allows the Object to try to release resources and perform other cleanup operations before "Garbage Collection" recycles the Object.

GetHashCode () is used as a hash function of a specific type.

GetType () gets the Type of the current instance.

ReferenceEquals () determines whether the specified Object instance is the same instance.

ToString () returns the String of the current Object.

String type

Is a very important and special class.

In. NET, String is an unchangeable object, which encapsulates a String of unchangeable characters. Once a String object is created and assigned a value, it cannot be changed.

Here you can refer to: blog Park Li huijun's article. Do you really understand strings in. NET?

Array class 

Its class is the parent class of the array in the runtime of the common language. Is an abstract base class

It defines the methods for creating, searching, and sorting arrays that can be modified.

Console class

It provides methods and attributes for the console application to access standard input/output and error streams.

The following is a console application

    class Program
{ static void Main(string[] args)
{
System.Console.WriteLine("hell World");
}
}

Console applications can also return values. According to the Convention, if the returned value is O, the program ends normally. If other values (such as-1) are returned, an error occurs.

 

Code

 class Program
{
static int Main(string[] args)
{
int value = 0;
if (args[0] == "a")
value = 1;
else if (args[0] == "b")
value =2;
return value;

}
}

Obtain the console value.

 

Code

Try
{
Process pro = new Process ();
// Do not display the window
Pro. StartInfo. CreateNoWindow = true;
Pro. StartInfo. UseShellExecute = false;
// Console program to be called
Pro. StartInfo. FileName = @ "C: \ Documents ents and Settings \ Administrator \ My Documents ents \ Visual Studio 2005 \ Projects \ ConsoleApplication1 \ ConsoleApplication1 \ bin \ Debug \ ConsoleApplication1.exe ";
// Pass the value to the parameters of the console Program
Pro. StartInfo. Arguments = this.txt Value. Text. Trim ();
Pro. Start ();
// Call the return value of the console Program
Int I = pro. ExitCode;

Response. Write (I. ToString ());
}
Catch (Exception ex)
{
Response. Write (ex. Message );
}

 

Environment class

Provides information about the current environment and platform and methods to operate on them. This class cannot be inherited.

Method

Exit () Terminate the process and provide the specified exit code for the basic operating system.
GetCommandLineArgs () Returns a string array containing the command line parameters of the current process.

Important attributes

OmmandLine obtains the command line of the process.

CurrentDirectory gets or sets the fully qualified path of the current working directory.

ExitCode gets or sets the exit code of the process.

HasShutdownStarted gets a value indicating whether the Common Language Runtime is shutting down or the current application domain is uninstalling.

MachineName: Obtain the NetBIOS Name of the local computer.

NewLine gets the NewLine string defined for this environment.

OSVersion: obtains the OperatingSystem object that contains the current platform identifier and version number.

ProcessorCount gets the number of processors on the current computer.

StackTrace obtains the current stack trace information.

SystemDirectory gets the fully qualified path of the system directory.

TickCount obtains the number of milliseconds after the system is started.

UserDomainName gets the network domain name associated with the current user.

UserInteractive gets a value to indicate whether the current process is running in user interaction mode.

UserName: Obtain the UserName of the person currently logged on to the Windows operating system.

Get a Version object that describes the main Version, next Version, internal Version, and revision number of the common language runtime.

WorkingSet obtains the amount of physical memory mapped to the process context.

File System Operations

FileSystemInfo Directory, Directoryinfo, File, and Fileinfo

Reflection

Application hierarchy

Assembly class, Module class,

Member Information

Memberinfo class, MethodBase class, ConstructorInfo class, EventInfo class

MainifestResourceInfo class Methodinfo class, ParameterInfo class, propertyInfo class

Other members of SystemReflection,

BindingFlags class: IReflect enumeration Pointer class

File Operations

Encoding class, AscIIEndoing class, UnicodeEncoding class,

UTF7Encoding class UTF8Encoding class, Decoder class

StringBuilder class

Regular Expression

Capture class

CaptureCollection class

Group Class

Match MatchCollection

Regex class

RegexOptions Enumeration

Multithreading

Thread, Monitor, WaitHandle, and Mutex ReaderWriterLock. ThreadPool, Timeout,

InterLocked class,

ThreadStart delegate,

ThreadPriority enumeration and ThreadState Enumeration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.