C # common classes and methods,

Source: Internet
Author: User

C # common classes and methods,

C # common classes and Methods

1.Data Type Conversion Function

Convert. ToXXX ();

XXX. Parse ();

XXX. TryParse ();

2.Date-related classes and functions

Obtain the current system date (including time): DateTime. Now

Obtain the current system date (excluding the time): DateTime. Today

Obtain the year, month, day, hour, minute, second, and millisecond of the DateTime object.

Date comparison function: Compare ()

Add the corresponding days, months, years, hours, minutes, And seconds to the specified date.

Get the days of a specified year: DaysInMonth ()

Use TimeSpan to describe a period of time

3.String-related functions

String Formatting Function: string. Format ()

Substring function: Substring ()

Judge whether string A Contains string B: Contains ()

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

String segmentation function: Split ()

Removes the start and end of a specified character function: Trim ()

Fill in the character PadLeft () with the specified number of digits on the left side of the string ()

Fill in the character PadRight () with the specified number of digits on the right of the string ()

String concatenation function: Concat ()

Determines whether string A starts with string B: StartWith ()

Determine whether string A ends with string B: EndWith ()

String replacement function: Replace ()

String case-sensitive conversion functions: ToLower (), ToUpper ()

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

Determines whether the string is Null (Null or "" or ""): IsNullOrEmpty (), IsNullOrWhiteSpace ()

4.String Formatting Function

Format Date: yyyyMMdd HHmmssfffffff

Formatted as a group of three digits: ToString ("N ")

Format currency: ToString ("C ")

Formatted as a floating point number with a specified decimal point: ToString ("F ")

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

5.Value Type and reference type

What is the value type and reference type?

C # Common Data Types

Default values of ref, out, params, and method parameters

6.Others

Random Number Generation: Random. Next ()

File Operation: File. readAllText (), File. exists (), File. readAllText (), File. writeAllText (), File. copy (), File. move (), File. delete ()

Generate GUID: Guid. NewGuid ()

Generic List <T>

7.Database Operations

Connection, Command, DataAdapter, DataReader, DataSet

Parameterization processing DbParameter

Proficient in SqlHelper. cs

8.Senior Programmer

Delegation and events

Generic

Reflection

Multithreading

Network Programming

Graphic image programming (GDI +)

Insecure code

WPF

WCF

WF

 


In the C language, what is the symbol (->) and how to use it?

This is a symbol in the struct pointer. Write a program to explain it, for example:
# Include <stdio. h>
Struct STU // define a struct
{
Int num;
} Stu;
Int main ()
{
Struct STU * p; // defines a struct pointer.
P = stu; // p points to the struct variable stu.
Stu. num = 100; // attaches an initial value to the struct member num.
Printf ("% d", p-> num); // output the num value in stu
Return;
}
As you can see, the-> method is to reference the variable in the struct !!
Format: p-> struct member (such as p-> num)
The function is equivalent to stu. num or (* p). num.
I don't know. You don't understand, and don't understand call me. O (∩ _ ∩) O ~
Hope to adopt it.

In the C language, what is the symbol (->) and how to use it?

This is a symbol in the struct pointer. Write a program to explain it, for example:
# Include <stdio. h>
Struct STU // define a struct
{
Int num;
} Stu;
Int main ()
{
Struct STU * p; // defines a struct pointer.
P = stu; // p points to the struct variable stu.
Stu. num = 100; // attaches an initial value to the struct member num.
Printf ("% d", p-> num); // output the num value in stu
Return;
}
As you can see, the-> method is to reference the variable in the struct !!
Format: p-> struct member (such as p-> num)
The function is equivalent to stu. num or (* p). num.
I don't know. You don't understand, and don't understand call me. O (∩ _ ∩) O ~
Hope to adopt it.

Related Article

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.