Item1: Always use properties instead of accessible data members
Attributes are an important feature in C #. We can use attributes to encapsulate members.
From the compiler's point of view, attributes are two methods for member variables: get_xxx
Const defines a static value that is often assigned during object initialization. It cannot be changed later. It is a compilation constant. New cannot be used for initialization.
Readonly is a read-only variable. It is a runtime variable. You can
Exception: The base class of all Exception objects.
Systemexception: The base class of all errors generated during the runtime.
Indexoutofrangeexception: It is triggered when the subscript of an array exceeds the range.
Nullreferenceexception:
1. Magic VaR
Added a variable declaration VaR in C #3.0, which is similar to the Javascript var, but also different.
1. similarities. It can be used to declare any type of local variables.
2. The difference is that it only tells the
Before creating any instance of the type, we need to initialize the static member variable of this type. C # can complete this task through the static initialization or static constructor, the static constructor is a special function that is
Initialization is recommended when variables are declared because the types we define often have multiple member variables, which leads to multiple constructors, in this way, the member variables and constructors may not be synchronized. We can
A layer of replacement is introduced between classes. Replacement means that the instance of one class can be replaced with the instance of another class. For example, in a class hierarchy, where parent classes are used, we can replace them with
We generally use the new modifier on Class Members to redefine non-Virtual members inherited from the base class. However, we do not recommend that you do this, this is because redefinition of non-virtual methods can lead to ambiguous behaviors.
An exception is a mechanism for reporting errors. The error processing location may be far from the location where the error occurs. All information about the error cause must be stored in the exception object. In this process, we may want to
The. NET runtime was designed to block the vulnerability of malicious code penetration and execution on remote machines, but some distributed systems always need to download and execute code from remote machines. If the CLR cannot fully trust an
We recommend writing short and concise methods instead of lengthy and complex methods. The main reason is the jit mechanism of. net.
When a program written in C # code is running, two steps are required: 1) the C # compiler compiles the source code
This topic is not just. net, in other object-oriented language environments, such as Java, there will be interfaces and abstract classes. There have been too many discussions about whether to choose an interface or abstract class, there is a design
1. Regular Expression: system. Text. regularexpressions. RegEx. Replace (STR, "([] + )","")-- STR is the input or string to be checked.
2. Use the string's built-in replace method: Str. Replace ("","")------------- STR is the input or string to be
For XML: sysproperty. xml
This article mainly introduces two ways to read and modify this XML,
The first is reading through xmldocument, and the second is serialized reading.
I. xmldocument method:
1. Read XML and save the attribute name and
This article introduces three thread security Modes
1, lock
2, mutex
3, methodimpl
Previously written MySQL database connection pool connectionpool. CS
Using system; using system. collections. generic; using system. LINQ; using system. text; using
What is an event? Event? Click Event? Load events? A series of vague concepts impact our weak head
Let's take a look at the more orthodox ideas:
An event is a way to provide notifications when something is concerned with it.
Generally, events
Summary is very comprehensive, so the full text reproduced, original: http://www.cnblogs.com/michaelxu/archive/2008/09/20/1293716.html
During programming, we sometimes use multiple threads to solve the problem. For example, your program needs to
In the preface, you should have a little understanding of the importance of delegation and events. Although we can still be vague, from my vernacular series, I will make these concepts easy to understand. First, let's talk about delegation first.
I learned linqtosql most, pulled lambda expressions, pulled anonymous methods, pulled delegation, and finally involved event processing... Later I found that I did not have a clear understanding of the concept of delegation and the process of
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