Common C # classes

Source: Internet
Author: User

(a) Math class: Math1. Math.ceiling (Fractional/integer): Returns the smallest integer greater than the current decimal2. Math.floor (Fractional/integer): Returns the largest integer less than the current decimal Console.WriteLine (math.ceiling (3.14));//4Console.WriteLine (Math.floor (3.14));//3Console.WriteLine (Math.ceiling (3.0));//3 3. Math.pow (2,3) to evaluate the index. Equivalent to 2 of the 3-time Square4. MATH.SQRT ( -) Open Square. 5. Rounding. Math.Round (3.63);//4Math.Round (3.14);//3(ii) Date Time: datetime construct: DateTime DT=Newdatetime (); Current time: DateTime DT=DateTime.Now; Date Time Object data: year,month,day,hour,minite,second,milliseconddayofweek--day of the week. dayofyear--the first day of the year. date--Date part of the collection period. timeofday--time period part. Functions of DateTime objects: AddYears (intnum) AddMonths (intnum) AddDays (intnum) AddHours (intnum) AddMinutes (intnum) AddSeconds (intnum) datetime data can be subtracted directly, returning the number of days and times between two dates. (c) String*Length: The lengths of the strings. ToLower (): All turns into lowercase toupper (): All turns into uppercase TrimStart (): TrimEnd (): Trim (): A space at the ends of the press. *indexof ("Sub-string"):(intreturns the position of the substring in the first occurrence of the string. *lastindexof ("Sub-string"):(intreturns the last occurrence of a substring in a string. The above two functions, if the corresponding substring is not found in the string, returns-1*substring (intstart[,intLength]): (string) to intercept the substring. Replace (stringOldstring New):(stringThe old swop of the string into a new string

Common C # classes

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.