C#两个引用类的属性、方法 各位早安

***字符串.IndexOf("串"); - 返回字符串中第一个匹配项的索引,如果没有匹配项返回-1  int
int b = s.IndexOf("天",s.IndexOf("天")+1); //获得第二个匹配项,3 4 5 6

字符串.LastIndexOf("串"); - 返回最后一个匹配项的索引

***字符串.StartWidth("串"); - 判断是否以什么开头
***字符串.EndsWidth("串"); - 判断是否以什么结尾
******字符串.Contains("串"); - 判断是否包含   string

****s.Replace(要替换的字符串, 替换的字符串); - 字符替换  string
s.Remove(3);  - 移除从索引到末尾的全部字符  string

+++++Math类+++++
Math.Pow(x,y); - 次方
Math.Sqrt(x); - 平方根

Math.Ceiling(double); - 取上限
Math.Floor(double); - 取下限
Math.Round(double); - 取四舍五入
Math.Abs(double); - 取绝对值

+++++DateTime类+++++
DateTime 变量名 = new DateTime(); - 定义

DateTime.Now; - 获取此电脑当前时间

.ToString("Format"); - 设置日期格式化,
yyyy-年 MM-月 dd-日 hh-12制小时 HH-24制小时 mm-分钟 ss-秒  ms-毫秒

.AddYears(); - 在此时间基础上增加多少年
.AddMonths(); - 增加月
.AddDays(); - 增加日
.AddHours(); - 增加小时
.AddMinutes(); - 增加分钟
.AddSeconds(); - 增加秒

.Year; - 获取此时间变量的年份
.Month; - 获取月份
.Day; - 日
.Hour; - 小时
.Minute; - 分钟
.Second; - 秒
.Millisecond; - 毫秒

.DayOfYear; - 获取当前日期是此年中的第几天
.DayOfWeek; - 获取是星期几

.TimeOfDay; - 获取时间部分
.Date; - 获取日期部分


TimeSpan类型 - 时间间隔类型
.Days - 差距多少天
.Hours - 一天中差距多少小时
.Minutes - 一天中差距多少分钟
.Seconds - 一天中差距多少秒
.Milliseconds - 毫秒

.Total.... 累计差距

原文地址:https://www.cnblogs.com/TheJoker/p/7776498.html