After searching for nearly an hour, I found no complete online description of what is a public class and how to use a public classArticleSo I am still confused about this problem. I will record the search results for this hour and try to understand
1. Calculate the time interval between two datetime values.Two methods:
1. Two datetime values are directly subtracted, and a timespan is obtained, indicating the interval between the two datetime values.
2. Use the datetime. Subtract (datetime)
There are two common methods for infinite loops:
While (1) and (;;).
The two methods have the same effect. In contrast, which one is better?
After compilationCodeComparison:
1. While (1 );
00401028MoV eax,10040102d test eax, eax0040102f je main+
C # How to obtain the coordinates of the mouse over the current window
You can use control. mouseposition to obtain the coordinates of the current mouse, and use pointtoclient to calculate the coordinates of the mouse relative to a control, as
// Convert the number two, eight, ten, and hexadecimal to a string
Convert.Tostring (number to be converted, in hexadecimal format );
Example:StringStrresult; strresult =Convert. Tostring (253, 2 );// Result: strresult = 11111101Strresult
When developing C # winform, you sometimes need to drag a file or folder into the specified control. Obtain the information of the files or folders dragged in by the user and perform the next step.
There are many problems related to Baidu or
Many times we need to use C #CodeWhen the form is in the current focus, perform other multi-button operations. For example, the operation is similar to that of QQ Ctrl + enter to send information. Use Form.The processcmdkey method is a good solution.
When we call a function written in FORTRAN in C # And contain array parameters, we need to do the following two operations.
1. Parameter declaration:
For example, if the parameter is an integer array, whether it is a one-or two-dimensional array,
In the past, we have always been engaged in the inheritance of a single class, but in real life, some new things often have the attributes of two or more things. To solve this problem, c ++ introduces the concept of multi-inheritance,
C ++ allows
(10:13:48)
The system. Io namespace contains the main classes used for file input and output.
File: provides many static methods for moving, copying, and deleting files.
Directory: provides many static methods for moving, copying, and deleting
Example:
Public void Sendmail ( String From, String To, String Subject, String Body ){ String Mailservername = "Smtp.test.com" ; Try { // Mailmessage represents the e-mail being sent Using (Mailmessage message = New Mailmessage (from, to, subject,
[Reprint] C # How to implement externalProgramDynamic call
Use the cmd.exe program and external program
Using system;Using system. diagnostics;
Namespace applycmd{///
/// Summary of cmdutility.///Public class cmdutility{///
///
Conversion from: getting the file path from mongoshake winform
String str1 = process. getcurrentprocess (). mainmodule. filename; // obtain the file name of the currently executed exe.String str2 = environment. currentdirectory; // obtain and set
InProgramAfter writing the program, if we want to constantly upgrade the functions of the program and use the previous ideas to write the program, we can only add and change the main programCodeIs there no other way? The answer is yes. How can this
To use the C # reflection technology, you must first introduce system. reflection namespace, the class in this namespace, has dynamic loading assembly, type, the function of dynamically calling a method, setting and obtaining the values of
The pop-up window killer is a program that can automatically close the IE pop-up window. It works in the system tray, checks the IE window at a certain interval, and closes the pop-up window. Finally, the pop-up window can be killed by using hotkeys.
1. # define
Macro definition. The pre-processor replaces the code with a string before compilation. Macro definition is not a statement, and ";" is not followed.
2. typedef
Typedef is processed during compilation, and an existing type and alias are
Document directory
Open an XML
Select a node based on xpath
Access xmlnode
Basic XPath syntax
XML query class and Test
The operating XML file must reference the system. xml namespace.
Using system. xml
Open an XML
Generally, load the XML file
C #3.0 the extension method is to add a method to the existing type.// Demo -- 1 // extended basic type namespace testextensionmethods {
// A static class must be created to include the extension method public static class extensions {
// The
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