Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 13 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
13
Dung lượng
249,12 KB
Nội dung
72 Applied C# in Financial Markets Transactions were examined along with how the DataSet synchronises with the database Although there are automated ways provided in C# that are useful for prototyping, there are a series of methods to update the database directly that are more suitable for Enterprise applications Using the UpdateCommand, InsertCommand, and DeleteCommand properties of the DataAdapter object the database transactions are managed, and are well suited for either generated SQL statements or stored procedures 5 Input & Output Financial applications often need to handle or generate flat files originating from vendors, exchanges or legacy systems This section will introduce you to the simpler forms of I/O – from reading files to writing from files – and covers more complex I/O topics such as serialisation However, the more advanced topics such as socket connections and TCP/IP will not be covered here In C# there is a rich set of methods for handling files and passing data around in various formats, and those familiar with C++ or Java should find it is straightforward When you move data around you are streaming data, and the NET framework does lots by providing abstracted files, directories, buffered, and unbuffered streams 5.1 STREAMS Stream is the abstract class on which other classes are built to handle reading or writing bytes to or from some storage FileStream is based on the abstract Stream class and performs the read and write around a file as shown in Example 5.1 Example 5.1: FileStream method private void Filer() { byte[] data = new Byte[10]; FileStream fs = new FileStream("fx.txt", FileMode.OpenOrCreate); if (fs.Length == 0) { for(int i=0;i