Our goal is to write a program that is more efficient, robust, and easy to maintain.C#Code.
Principle 1: use attributes as much as possible (Property), Rather than data members (Field).
Always use properties instead of accessible data members.
For the following reasons, please try to use attributes instead of Members when designing the class.
1,.NetThe support for attributes is far greater than the support for members. You can bind at
currently.
Https://chrome.google.com/webstore/detail/yslow/ninejjcohidippngpapiilnmkgllmakh
Https://addons.mozilla.org/en-US/firefox/addon/yslow/
You should have some knowledge about the developer tools of these browsers. You can call up this tool by pressing F12.
VISAUL studio 2010 SP1 or later, Visual Studio 2012 is recommended
Http://www.microsoft.com/visualstudio/eng/downloads
You need to have a good understanding of the basic development proces
When I wrote the previous article to Guan Yu's night reading "Spring and Autumn", I had to entertain myself as a creative e-book advertisement. (If I was involved by an advertising company, I would like to divide it into ^-^ ).
------------------------------------------------------------------------- Advertising time, please renew -------- as soon as possible ---------------------------------------------------------------------------------------------
Test code:Super @ super-desktop :~ $ Cat Lib. h
# Ifndef _ lib_h
# DEFINE _ lib_h
Void lib_func ();
# EndifSuper @ super-desktop :~ $ Cat Lib. c# Include
Int super_a = 0;
Void lib_func (){Printf ("A is: % d \ n", super_a );Return;}Super @ super-desktop :~ $ Cat main. c# Include # Include "Lib. H"
Int super_a = 0;
Int main (){Super_a = 100;Lib_func ();Printf ("A in main is: % d \ n", super_a );Return 0;}
Output:
Super @ super-desktop :~ $ Gcc-shared-FPIC-g-o liblib. So Lib. c
Super @ super-des
Principle 1: Use properties as much as possible, rather than fields ).
Always use properties instead of accessible data members.
For the following reasons, please try to use attributes instead of Members when designing the class.
1 ,.. Net supports attributes much more than those of members. You can bind attributes to data, design instructions, and other content that many data members do not support. Look at the property panel in. net, you will unders
functions is to confirm the role of the member function and the const object. The reasons are as follows:① Make the class interface easier to understand② Make "operate const object" Possible
2) In member functions, if they only have different constants, they can be overloaded, for example:
1 class string { 2 public: 3 char operator[](int position){ //★ 4 return data[position]; 5 } 6 const char operator[](int position) const { 7 return data[position]
... catch... finally to catch errors, or directly use response. Write () to output the value of the variable.
(2) check whether there are uninitialized variables in the code
III,
Sqlconnection. Open has not set the object reference to the instance of the object.
When using vs2003 to Develop ASP. NET programs, sometimes the open () method of the sqlconnection object appears.
You have not set the object reference to the instance of the object.
Note: An unhandled exception occurs during the runni
... catch... finally to catch errors, or directly use response. Write () to output the value of the variable.
(2) check whether there are uninitialized variables in the code
III,
Sqlconnection. Open has not set the object reference to the instance of the object.
When using vs2003 to Develop ASP. NET programs, sometimes the open () method of the sqlconnection object appears.
You have not set the object reference to the instance of the object.
Note: An unhandled exception occurs during the runni
T); but in the test, I call: F (2); this will cause problems, this is because I passed in a very mass reference, and it should be an object, but I passed in a constant during the call. Therefore, a very large number of references will be ineffective and an error will be reported. But if it is a constant reference, it can cope with this situation! This is because constant reference has a special feature that enables the compiler to create a temporary object to handle this situation. Let's take
Problem 31 In England and the currency is made up of pound, round, and pence, P, and there are eight coins in general circulation:
1 p, 2 p, 5 p, 10 p, 20 p, 50 p, half 1 (100 P) and half 2 (200 P ).
It is possible to make every 2 in the following way:
1 × Jun 1 + 1 × 50 p + 2 × 20 p + 1 × 5 p + 1 × 2 p + 3 × 1 p
How many different ways can be used 2 be made using any number of coins? Import timedef CAL (sum, C
In the Search Engine's robot Search, the "text" such as type, text, and html have the highest degree of friendliness (except for text/xml at present ), the friendliness of text and javascript is not ideal. If the robot still needs to judge the DHTML code, the complexity is also high and it cannot be inferred.
Therefore, you need to improve the Code friendliness during DHTML programming. The better way is to "simplify DHTML code into code without HTML as much as
Possible reasons why the Struts2 verification framework does not work1. Whether the name complies with the Conventions:-Validation. xml-- Validation. xml2. Check whether the validation. xml tag is correct, such as whether to disable all tags and whether to disable one more tag. Note: There are no prompts for this error, but verification does not work.3. Whether the name of fieldName is consistent with the attributes in jsp and action, for example:Acti
should be included:Suppose you find that the "Wireless Zero Configuration" dependency has "Event Log", the following text please ignore directly. Your situation is not what this article can solve.Suppose there is no "Event Log" entry. Dependencies must be added manually through the registration form:Click "regedit" to enter the registration form and enter the following entry: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services]Locate the "WZCSVC" Item and double-click its value entry "DependO
Possible new features of C # 6.01. Main constructor (Primary constructors)The main constructor assigns a value to a variable in a classBeforepublic class Point { private int x, y; public point (int x, int y) this.x = x; This.y = y; }}Afterpublic class point (int x, int y) { private int x, y;}2. Automatic attribute Assignment (auto properties)before Class Point {public int X {get; private set;} public int Y {
match!" "Passers-by saw this scene, a face touched to say." "Yes, I see the way they quarrel, lovely, oh, should have been good!" "Passers-by B also made a speech. Ning smile Angry red Eye, ghost of match, these people blind off, obviously is this smelly man in strong kiss oneself Ah! The first trick to prevent wolves! Better laugh and laugh at the knee, toward the top of Liang crotch. It is the Liang pain to wake up, Ning smile this only mercilessly pushed him, turned to drill into t
be counted.Then this topic TM also card accuracy!!! I decided when the two points each time the car's landing, the results of n=1w when the accuracy exploded, and then WA.Then the out-of-court consultation (fog) changed a decision method (yes, it's mathematically)1#include 2#include 3#include 4#include 5#include 6#include 7#include 8#include 9#include Set>Ten#include One#include A #defineLL Long Long - #defineINF 0X7FFFFFF - #definePA pair the using namespacestd; - inline LL read () - { -LL x
need to promote the enterprise, red users and backstage designers to discuss the real needs of the parties, and through the Bingjun staff internal trial, several improvements APP. at present, the Reds dot dot The APP optimizes the process of binding resources and downloads the installation for free. Registration process is simple and fast, real realization of a key registration, at any time to make money. and The APP interface is clear, easy and quick. The current number of users and the number
The basic data types are from low to Advanced: (Byte,short,char)--int--long- - float -- DoublePS: The "level" here refers to the size of the range that represents the value.--------------------------------------------------------------------------------------------------------------- --For a double-precision real class,Doublevalue () can get its corresponding double-precision real variable, and intvalue () can get its corresponding integer variable. This method can be used when fetching 123.45 (
here and ask to change immediately, that this small point also become easy to promote the type.Speaking of these, to raise the central idea ... You can't always just do what you think is right, and to keep your team productive, you need to obey, but that doesn't affect your sanity. Also can still according to the feedback after the line to know oneself is right, or think more, or is actually oneself wrong.In addition, even if you do not follow the direction of their own satisfaction, as long as
Because the controller's name is generally capitalized, such as login at this timeClass Logincontroller {def index = {Redirect (action:Login, Params:params)}def login={}Then there will be an error that cannot be found on the login controller.Note that at this point login should be changed to lowercase beginning as followsClass Logincontroller {def index = {Redirect (action:login, Params:params)}def login={}One possible reason for grails redirect not t
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.