TAILIEUCHUNG - Applied C# in Financial Markets phần 4

điều hành ưu tiên Trong C #, như trong hầu hết các ngôn ngữ lập trình khác, các nhà khai thác có quy định khác nhau của ưu tiên là các so sánh nhà điều hành làm việc từ trái sang phải trong khi các nhà khai thác chỉ định phải sang trái Hãy xem xét những biểu hiện trong | 20 Applied C in Financial Markets before the code body has executed. In Example while is used with an enumerator with the MoveNext method which will return true until there are no more records to be processed. Example while loop shown in context of an enumerator while t do while do code body while condition do while is similar to while the big difference being in evaluating the condition. In do while the condition is examined after the code body in the loop has run whereas while evaluates the condition before looping. In Example a file is being read until the line returned is null note that the ReadLine is executed before the check that line is null. Example do while loop evaluating the line after the loop being processed do line if line null string ccFX line ccFX 0 ccFX 1 while line null for loop for initialise counter exit condition counter code body The block of code in a for loop iterates around with the counter being initialised the condition checking and the counter all being on the same line. The Basics of C 21 In Example the for loop begins at zero and loops around until the condition I _initialPool is met the example shows the for loop used in initialising a number of database connections. Example For loop showing a number of connections being initialised private void initConnections for int i 0 i _initialPool i addConnection i foreach loop foreach element in collection code body The foreach loop is used to iterate through either collections or arrays and goes through each element until the last one is reached. In writing a foreach loop the structure of the collection should remain unchanged otherwise the loop could cause some unpredictable results. Example shows a collection being created and the elements being iterated through. The example is taken from a class that builds a dynamic string of SQL. Example .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.