public string FirstName { get; private set; }
public string LastName { get; private set; }
public string FirstName { get; }
public string LastName { get; }
public Student(string firstName, string lastName)
{
FirstName = firstName;
LastName = lastName;
}
public string FirstName { get; set; } = "Corleone";
public string LastName { get; set; } = "Mike";
public Student Create() => new Student();
public Student Create()
{
return new Student();
}
public string FullName => string.Format("{0},{1}", FirstName, LastName);
public string FullName
{
get
{
return string.Format("{0},{1}", FirstName, LastName);
}
}
using static System.String; // 先导入对应成员类型 public bool IsNull(string str) => IsNullOrEmpty(str);
public bool IsNull(string str) => string.IsNullOrEmpty(str);
var student = new Student(); var firstName = student?.FirstName;
var student = new Student();
string firstName = null;
if (student != null)
{
firstName = student.FirstName;
}
int? age = student?.Age;
var fullName = $"{student.FirstName},{student.LastName}";
var fullName = string.Format("{0},{1}", student.FirstName, student.LastName);
Console.WriteLine($"平均成绩:{student.GPA:F2}");
Console.WriteLine($"平均成绩:{(student.GPA > 80 ? student.GPA : 0):F2}");
var score = $"我的各科成绩:{ $"数学:{student.MathScores};英语:{student.EnglishScore};"}";
try
{
throw new WebException("Request timed out..", WebExceptionStatus.Timeout);
}
catch (WebException webEx) when (webEx.Status == WebExceptionStatus.Timeout)
{
// Exception handling
}
public string FullName(Student student)
{
if (student == null)
throw new ArgumentNullException(nameof(student));
return $"{student.FirstName},{student.LastName}";
}
public static async Task<string> MakeRequestAndLogFailures()
{
await logMethodEntrance();
try
{
// ....
var responseText = await streamTask;
return responseText;
}
catch (System.Net.Http.HttpRequestException e) when (e.Message.Contains("301"))
{
await logError("Recovered from redirect", e);
return "Site Moved";
}
finally
{
await logMethodExit();
}
}
var list = new List<string>()
{
"Mike",
"Jim"
};
var dic = new Dictionary<int, string>()
{
{ 20, "Mike" },
{ 30, "Jim" }
};
var dic = new Dictionary<int, string>()
{
[20] = "Mike",
[30] = "Jim"
};
static Task DoThings()
{
return Task.FromResult(0);
}
Task.Run(DoThings); // 此处省略方法代码...
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有