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
A backup is retained, which is used for simple log recording. C #
private object o = new object (); Private Static string getfiles () {// determines whether a path or file exists, if the resource does not exist, the related resource string dir =
Many of my friends will encounter the problem that the label content to be displayed is too long but cannot be changed in winform development. Here I have summarized several methods for your reference.
First, set the label autosize attribute to
Let's take a look at the following:Code:
String strparam = request. params ["Param"]; If (strparam = NULL) {strparam = "";} string strparam = request. params ["Param"] = NULL? "": Request. Params ["Param"];
You find that although the same
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
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
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
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
Of course, the system. Io namespace must be introduced.
First:
Public static long getdirectorylength (string dirpath){// Determine whether the specified path exists. Exit if it does not exist.If (! Directory. exists (dirpath ))Return 0;Long Len = 0;
I. C # Delegate class
A delegate is similar to a function pointer, but a function pointer can only reference static methods. A delegate can reference both static methods and instance methods.
Delegated use is divided into three steps: 1. Delegate
C # image movement and RotationAbstract: 1. Rotate E. graphics. rotatetransform (30366f, matrixorder. prepend); 2. Pan E. graphics. translatetransform (100366f, 0.0f); 3. Scale E. graphics. scaletransform (3.0f, 1.0f, matrixorder. append); 4.
Click here to contact me if you require any freelance Development«Equals why? And why not = mono-web development on Linux» events-fire that event
An event will be fired when something has happened and then you can link to that event and do something
1. Run gcc/egcs
GCC is the most important software development tool in Linux. GCC is the gnu c and C ++ compilers. In fact, GCC can compile three languages: C, C ++, and objectc (an object-oriented extension of C ). The GCC command can be used to
Requirements: 1. The number of rows ranges from 3 to 21, and "invalid number of rows" is thrown for the invalid number of rows ";
2. Print the inverted triangle of the number of rows on the console;
Implementation Code:Static void main (string []
The project team was prepared to bring people to the encapsulation SDK and wanted to find a good tutorial to learn from him. However, I was not satisfied with the online searching for a long time. I wrote one myself.
If you have any questions, try
Hill sorting (downgrading incremental method)
It is a sort of insertion class, which divides the entire unordered column into several small subsequences for insertion sorting respectively.
Sorting process: first take a positive integer D1
Initial:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> private static void ReverseArray(int[] array) { int temp;int count = array.Length;for (int i = 0; i {
The basic concept of bubblesort is to compare two adjacent numbers in sequence, put decimal places in front, and put large numbers in the back. That is, first compare the numbers of 1st and 2nd, and put the decimal places before and after the large
I introduced a convenient way to use mutex lock by closing the critical section object. All examples in this article are two threads reading and writing the same data, therefore, they must be mutually exclusive and cannot be accessed at the same
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