C # Common classes and Methods < go >

Source: Internet
Author: User

1. data type conversion Functions

Convert.toxxx ();

Xxx. Parse ();

Xxx. TryParse ();

2. Date-dependent classes and functions

Get system current date (including time): DateTime.Now

Get system current date (not including time): Datetime.today

Gets the year, month, day, time, minute, second, and millisecond of a DateTime object

Date comparison function: Compare ()

Adds the appropriate number of days, months, years, hours, minutes, and seconds to the specified date

Gets the number of days specified: DaysInMonth ()

Use a timespan to describe a period of time

3. string-related functions

String formatting function: String. Format ()

Take substring function: Substring ()

Determines whether string a contains a string b:contains ()

Get the index of string A in string B: IndexOf () LastIndexOf ()

String Split function: Split ()

Culling the specified character function: Trim ()

Fills the character of the specified number of digits to the left of the string: PadLeft ()

Fills the character of the specified number of digits to the right of the string: PadRight ()

string concatenation function: Concat ()

Determines whether string a begins with string B: Startwith ()

Determines whether string a ends with string B: Endwith ()

String substitution function: replace ()

string-Case Conversion functions: ToLower (), ToUpper ()

Removes the specified string B function from string A: Remove ()

Determines whether the string is empty (null or "" or "): IsNullOrEmpty (), Isnullorwhitespace ()

4. string Formatting functions

Formatted Date: YyyyMMdd hhmmssfffffff

Number formatted as a 3-bit group: ToString ("N")

Formatted currency: ToString ("C")

Format a floating-point number with the specified scale: ToString ("F")

String.Format ("{0:YYYYMMDD}", DateTime.Now);

5. value types and reference types

What are value types and reference types

Common data types in C #

Default values for ref, out, params, method parameters

6. Other

Generate random Number: Random.next ()

File operations: File.readalltext (), file.exists (), File.readalltext (), File.writealltext (), File.Copy (), File.move (), File.delete ()

Generate GUID:Guid.NewGuid ()

Generic-Class List<t>

7. Database Operations

Connection, Command, DataAdapter, DataReader, DataSet

Parametric processing DbParameter

Familiar with SqlHelper.cs

8. Senior Programmer

Delegates and events

Generic type

Reflection

Multithreading

Network programming

Graphic image Programming (GDI +)

Unsafe code

Wpf

Wcf

Wf

C # Common classes and Methods < go >

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.