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
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
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
(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
{..
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
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 =
Everyone will write code! A few months of programming experience allows you to write "runable Applications ". It is easy to run, but coding in the most efficient way requires more effort!You know, most programmers are writing "executable code" instead of "efficient code". As we mentioned above, do you want to be the "most distinguished professional" of your company? Writing "efficient code" is an art. You must learn and practice it.
Naming Conventions
This specification applies to all C #-based development. NET Platform project, providing reference and basis for detailed design, code writing and code review.First, the code formatTo make all indents a tab, that is, 4 spaces, use the default settings for Vs.net.Align the opening and closing brackets vertically in your code.To prevent scrolling through the source editor while reading the code, each line of code or comment should try not to exceed a di
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.