Home > ADM > ADMC331BST
ADMC331BST Datasheet | Analog Devices
Part No. : ADMC331BST
Description : Single Chip DSP Motor Controller
Download : ADMC331BST Click to Download
Page Number : 36
Manufacturer : Analog Devices
File Size : 248 Kb

ADMC331BST Article About

The above code will be no output when running it? Our intention is to capture in our anonymous method in the loop counter i and display it. We expect that the output should be as follows: 12345 But if you run the above code, the output will be as follows: 66 666 if we remember that we carefully about the inner workings of an anonymous method of knowledge, I mentioned: the anonymous method is any local variable to capture the scope will be created within a new instance of the class data members instead. For loop control variable, the scope is the scope containing the for loop, which is the simple code shown above main method body. So when the code is compiled, C # compiler creates an internal instance of the class code, packaging, anonymous methods and loop counter, outside the for loop. And that the data within the instance of the class members, on behalf of the loop counter, it will be used to substitute for the for loop but also in the anonymous method used in the original loop counter. So from within the same instance of the class data members are used for recycling and also used in the packaging method of an anonymous method instance. Cycle is completed as the result of an instance data member will increase six times. There is a great place to note: Although the five iterations of this loop in the end, in its structure out of the loop counter loop control variable is increased by six times. Since the loop control variable is an instance of the data member, the sixth increase triggered by the loop counter to provide loop termination condition. Since the same instance is used as a method of anonymous method delegate processor is called the end of the commission, all the delegate instances will be pointing to the same instance, while the members will show the same data value is 6. This is what I mentioned at the beginning of this section had dangerous side effects. To overcome this problem and get the expected results, the anonymous method should be scope in the for loop to capture a local variable, it will have the same with the loop counter value. This sample code can be obtained through the following changes: public class Program {public delegate void MyDelegate; public static void Main {MyDelegate d = null; for {int k = i; MyDelegate tempD = delegate; d + = tempD;} d;}}
"Tolerance day" to move the recorder brand products, mainly for fashion and business, with mobile recording needs of the consumer groups. Samsung SE-T084L day capacity, mainly in silver color, with black borders, while the fuselage has a clear "only supports the standard 8 cm and 12 cm discs," the words, which pair is the suction-type drive is particularly important. As a sucker design, so only the design on the front panel keys out of position, work lights and forcibly eject hole. Day capacity, using SE-T084L Slim models, ultra-thin body design, its volume size: 141mm 157mm 19mm, with only 19 mm thickness, 420 g weight, compact body directly into the bag, the carrying convenient.

All rights reserved:iceach.com © 2000-2010 Certificate No.:Guangdong ICP No.08108781