time-Read the code without looking at the function declaration for I/O at a glanceThe above is still a high degree of readability, but also can quickly locate the issue of compile time.Of course, it is difficult and unnecessary to consider these details in actual team development, but it is possible to understand the tastes and logic of a person. The quality of the code is really not particularly related to the success or failure of the product and the company, but as an engineer, we should pur
Efficient C # Coding optimization,
1. foreach VS for statement
Foreach has better execution efficiency thanThe average time spent by Foreach is only 30% of that of for. When both for and foreach can be used through the test results, we recommend using a more efficient foreach.In addition, the write time using for is about 10 times the read time.
2. Avoid using ArrayList
ArrayList performance is low. Any Obj
symbols, produce a diagnostic. varDiagnostic = Diagnostic.create (Rule, namedtypesymbol.locations[0], namedtypesymbol.name); Context. Reportdiagnostic (diagnostic); } }Running F5, the system returns a new VS replica window, we create a new ConsoleApp application,We can set breakpoints in the parser project to see the specific effect of the operation, such as I manually change program to PROGRAM2, the parser will detect changes, run the parser code, the specific
About the coding problems in C # development,
I have been working on various coding problems recently and have some experiences. I would like to share with you some of them.
System. Text provides the Encoding abstract class, which provides the string Encoding method. Common encoding methods include ASCII, Unicode, and UTF8 ).
Unicode has four encoding formats, UT
Unity3d game resource packaging and encryption (image/XML/TXT, etc.) C # Coding (1 ),
This article only describes the process and uses a very simple packaging encryption method. As for the encryption result, Please modify it as needed. The Byte offset and the backward and backward encryption methods can all be used, however, it generally does not need to be so complex, and the encryption is too complex, whi
Recently in the development of the smart home, the sub-module called the Turing Man (http://tuling123.com/openapi/cloud/home.jsp)But the discovery has been unsuccessful, the return value has been 4.0006 million-like debugging no results The last discovery is the problem of Chinese transcoding the general Web site will speak Chinese to do a transcoding, for the time being called UrlEncodeTranscoding process is very simple, because the Chinese encoding is not a byte, but a number of bytes (ASCLL c
(a) variable namingint I is prefixedint[] arr as prefixint* Pi as PrefixUnsigend int UI is prefixedUnsigend int* Pui as PrefixShort S is prefixedshort* PS as PrefixUnsigend short us as prefixUnsigend short* pus as prefixLong L is prefixedlong* Pl as PrefixUnsigend Long ul as prefixUnsigend long* Pul as prefixFloat F is prefixedfloat* PF as PrefixDouble D as Prefixdouble* PD as PrefixChar c is prefixedChar[] sz as prefixChar* pointing to a single chara
Delegate modeTipThe delegate object should not be retainThe class that implements the delegate pattern should:
Has an instance variable named Delegate_ to refer to the delegate.
Therefore, accessor methods should be named Delegate and setdelegate:.
Delegate_ objects should not be retain.
Model/view/controller (MVC)TipDetach the model from the view. Detach the controller from the view, model. The callback API uses @protocol.
Detach a model from a view: Do not assum
C # Coding specifications summarized by myself-6. FormatThe unified use of the format can make the code clear, beautiful, and easy to read. In order not to affect the encoding efficiency, the following rules should be made: the length of a file should not exceed 500 lines (except the class automatically generated by the IDE ). A file must have only one namespace. It is strictly prohibited to put multiple na
1. Avoid putting multiple classes in one file.
2. A file should have only one namespace and avoid placing multiple namespaces in the same file.
3. A file is best not to exceed 500 lines of code (excluding machine generated code).
4. The code length of a method is best not to exceed 25 lines.
5. Avoid cases where there are more than 5 parameters in the method. Use structs to pass multiple parameters.
6. Do not exceed 80 characters per line of code.
7. Do not manually modify the machine gener
Hungarian nomenclature for shared and protected members [3]
L never use abbreviated characters, such as using num instead of number
10. Always use C # predefined formats without using aliases in system space
Object Not 0bject
String Not string
int not Int32
11. General, for the format of the use of uppercase letters when processing. NET format type, use the type suffix
Correct:
public class linkedlist
{..}
Avoid:
public class Linkedlist
{..
judgment should adopt the indent style.
10. c/C ++ uses braces "{" and "}" to define a block. When compiling a block, '{' and '}' should each have an exclusive row and be located in the same column, at the same time, it is left aligned with the statements that reference them. At the beginning of the function body, the definition of the class, the definition of the structure, the definition of enumeration,
constant expression Static Const DoubleC5 =7.0;//error, not integral type};//Curious.cppConst intcurious::c1;//...(4) An array of members. If you have a default constructor when you construct an object of a class, you can define an array of this class without explicitly providing an initial formula.(5) Non-local object storage. Sometimes, we define a static class member that is used only once:class zlib_init{ zlib_init (); // enable zlib to use // make the zlib do the final cleanup
C # Coding specifications summarized by myself-4. Comments,
Note
Note is undoubtedly the fastest way to let others know your code as quickly as possible, but the purpose of writing a comment is not just to "explain what the code has done ", more importantly, try to help the code reader understand the code as much as the author does.
When you write code, there will be a lot of valuable information in your
C ++ cross-platform Coding
Recently, I want to put a windows project on Raspberry Pi to make full use of bandwidth resources and make it work overnight
Record the Encoding Problems and Solutions here
In windows, vs2015 is used, and the default code file is ANSI. It is a windows-specific concept and local code. In combination with the actual situation, it is gbbench.
When debugging vs, you can easily v
1. Invert stringsChar* STRREV1 (Const Char*str) { intLen =strlen (str); Char*temp =New Char[Len +1]; Char*p = temp +Len; *p =' /'; P--; while(*str! =' /') { *p--= *str++; } P=NULL; returntemp;}2. Implement strcmp, compare two strings, return the same 0, the former is greater than the latter return a positive number, conversely, return negativeFirst, the function prototype has to be written correctly:int strcmp (char *source, char *dest)intstrcmpChar*source,Char*dest) { intRET =
C # Coding specifications
Note: Pascal case-the first letter of all words is in upper case, and the other letters are in lower case.Camel case-except the first word, the first letter of all words is in upper case, and the other letters are in lower case.Class Name in Pascal casePublic class helloworld{...}Method Pascal casePublic class helloworld{Void sayhello (string name){...}}Variables and method
I. Coding rules for BASE64The idea of BASE64 encoding is to encode the data using 64 basic ASCII characters. It splits the data that needs to be encoded into a byte array. A group of 3 bytes. Arrange the 24-bit data in order, then divide the 24-bit data into 4 groups, that is, 6 bits per group. Then fill a byte with two 0 in front of each group's top digit. This encodes a 3-byte-A-group of data back into 4 bytes. When the number of bytes of data to be
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.