C# 教程 | 菜鸟教程
- http://www.runoob.com/csharp/csharp-tutorial.html
.NET API Browser | Microsoft Docs
- https://docs.microsoft.com/en-gb/dotnet/api/index?view=netcore-2.0
$ (C# Reference) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated
- Identifies a string literal as an interpolated string. An interpolated string is a template-like string that contains literal text along with interpolated expressions. When the interpolated string is resolved, for example in an assignment statement or a method call, its interpolated expressions are replaced by their string representations in the result string. Interpolated strings are replacements for the composite format strings supported by the .NET Framework.
- c# - What does $ mean before a string? - Stack Overflow
- https://stackoverflow.com/questions/31014869/what-does-mean-before-a-string
=> Operator (C# Reference) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/lambda-operator
- The
=>
operator can be used in two ways in C#:- As the lambda operator in a lambda expression, it separates the input variables from the lambda body.
- In an expression body definition, it separates a member name from the member implementation.
#region (C# Reference) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-region
#region
lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor. In longer code files, it is convenient to be able to collapse or hide one or more regions so that you can focus on the part of the file that you are currently working on.
Application startup in ASP.NET Core | Microsoft Docs
- https://docs.microsoft.com/en-us/aspnet/core/fundamentals/startup
- The
Startup
class configures services and the app's request pipeline.
async (C# Reference) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/async
- Use the
async
modifier to specify that a method, lambda expression, or anonymous method is asynchronous. If you use this modifier on a method or expression, it's referred to as an async method.
await (C# Reference) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/await
- The
await
operator is applied to a task in an asynchronous method to insert a suspension point in the execution of the method until the awaited task completes. The task represents ongoing work. await
can only be used in an asynchronous method modified by the async keyword. Such a method, defined by using theasync
modifier and usually containing one or moreawait
expressions, is referred to as an async method.
Enumerable.Select Method (System.Linq) | Microsoft Docs
- https://docs.microsoft.com/en-gb/dotnet/api/system.linq.enumerable.select?view=netcore-2.0#System_Linq_Enumerable_Select__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__
- Projects each element of a sequence into a new form.
FromBodyAttribute Class (Microsoft.AspNetCore.Mvc) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.frombodyattribute?view=aspnetcore-2.0
- Specifies that a parameter or property should be bound using the request body.
get (C# Reference) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/get
- The
get
keyword defines an accessor method in a property or indexer that returns the property value or the indexer element. - Auto-Implemented Properties (C# Programming Guide) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/auto-implemented-properties
- In C# 3.0 and later, auto-implemented properties make property-declaration more concise when no additional logic is required in the property accessors. They also enable client code to create objects. When you declare a property as shown in the following example, the compiler creates a private, anonymous backing field that can only be accessed through the property's
get
andset
accessors.
- How to: Implement a Lightweight Class with Auto-Implemented Properties (C# Programming Guide) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/how-to-implement-a-lightweight-class-with-auto-implemented-properties
- This example shows how to create an immutable lightweight class that serves only to encapsulate a set of auto-implemented properties. Use this kind of construct instead of a struct when you must use reference type semantics.
- You can make an immutable property in two ways. You can declare the set accessor.to be private. The property is only settable within the type, but it is immutable to consumers. You can instead declare only the get accessor, which makes the property immutable everywhere except in the type’s constructor.1
- When you declare a private
set
accessor, you cannot use an object initializer to initialize the property. You must use a constructor or a factory method.
Guid Struct (System) | Microsoft Docs
- https://docs.microsoft.com/en-gb/dotnet/api/system.guid?view=netcore-2.0
- Represents a globally unique identifier (GUID).
HttpClient Class (System.Net.Http) | Microsoft Docs
- https://docs.microsoft.com/en-gb/dotnet/api/system.net.http.httpclient?view=netcore-2.0
- Provides a base class for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.
HttpGetAttribute Class (Microsoft.AspNetCore.Mvc) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.httpgetattribute?view=aspnetcore-2.0
- Identifies an action that only supports the HTTP GET method.
- HttpPostAttribute Class (Microsoft.AspNetCore.Mvc) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.httppostattribute?view=aspnetcore-2.0
- Identifies an action that only supports the HTTP POST method.
- HTTP Methods GET vs POST
- https://www.w3schools.com/tags/ref_httpmethods.asp
- The two most used HTTP methods are: GET and POST.
Language-Integrated Query (LINQ) (C#) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/
- Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language. Traditionally, queries against data are expressed as simple strings without type checking at compile time or IntelliSense support. Furthermore, you have to learn a different query language for each type of data source: SQL databases, XML documents, various Web services, and so on. With LINQ, a query is a first-class language construct, just like classes, methods, events.
readonly (C# Reference) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/readonly
- The
readonly
keyword is a modifier that you can use on fields. When a field declaration includes areadonly
modifier, assignments to the fields introduced by the declaration can only occur as part of the declaration or in a constructor in the same class. - The
readonly
keyword is different from the const keyword. Aconst
field can only be initialized at the declaration of the field. Areadonly
field can be initialized either at the declaration or in a constructor. Therefore,readonly
fields can have different values depending on the constructor used. Also, while aconst
field is a compile-time constant, thereadonly
field can be used for runtime constants as in the following example : public static readonly uint timeStamp = (uint)DateTime.Now.Ticks;
String.IsNullOrEmpty(String) Method (System) | Microsoft Docs
- https://docs.microsoft.com/en-gb/dotnet/api/system.string.isnullorempty?view=netcore-2.0#System_String_IsNullOrEmpty_System_String_
- Indicates whether the specified string is
null
or an Empty string.
Task<TResult> Class (System.Threading.Tasks) | Microsoft Docs
- https://docs.microsoft.com/en-gb/dotnet/api/system.threading.tasks.task-1?view=netcore-2.0
- Represents an asynchronous operation that can return a value.
- Task<TResult>.Result Property (System.Threading.Tasks) | Microsoft Docs
- https://docs.microsoft.com/en-gb/dotnet/api/system.threading.tasks.task-1.result?view=netcore-2.0#System_Threading_Tasks_Task_1_Result
- Gets the result value of this Task<TResult>.
- Task.Status Property (System.Threading.Tasks) | Microsoft Docs
- https://docs.microsoft.com/en-gb/dotnet/api/system.threading.tasks.task.status?view=netcore-2.0#System_Threading_Tasks_Task_Status
- Gets the TaskStatus of this task.
- Task-based Asynchronous Pattern (TAP) | Microsoft Docs
- https://docs.microsoft.com/en-gb/dotnet/standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap?view=netcore-2.0
- The Task-based Asynchronous Pattern (TAP) is based on the System.Threading.Tasks.Task and System.Threading.Tasks.Task<TResult> types in the System.Threading.Tasks namespace, which are used to represent arbitrary asynchronous operations. TAP is the recommended asynchronous design pattern for new development.
Using Nullable Types (C# Programming Guide) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/nullable-types/using-nullable-types
- Nullable types can represent all the values of an underlying type, and an additional null value.
- Nullable types are declared in one of two ways: T is the underlying type of the nullable type. T can be any value type including struct; it cannot be a reference type.
-
System.Nullable<T> variable
-
T? variable
-
-
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/null-conditional-operator
- The
??
operator is called the null-coalescing operator. It returns the left-hand operand if the operand is not null; otherwise it returns the right hand operand.
var (C# Reference) | Microsoft Docs
- https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/var
- Beginning in Visual C# 3.0, variables that are declared at method scope can have an implicit "type"
var
. An implicitly typed local variable is strongly typed just as if you had declared the type yourself, but the compiler determines the type.
一文详解 Try 和异常的区别
开发者应当熟知的 C# 序列化和反序列化