... Reflection, and Metadata 103 3-1 Create an Application Domain 104 3-2 Create Types That Can Be Passed Across Application Domain Boundaries 106 3-3 Avoid Loading Unnecessary Assemblies ... content management, trading, portfolio management, strategic planning, and real-time search Allen is a partner at QuantumBlack, a design and technology studio that applies visual analytics to ... Lena, and our three wonderful girls, Anya, Alexia, and Angelina I love you all —Allen Jones For my wife, Jacqui Griffyth, who I love a great deal —Adam Freeman Contents at a Glance About the Author...
... // A private class used to pass initialization data to a new thread private class ThreadStartData { public ThreadStartData(int iterations, string message, int delay) { this.iterations = iterations; ... default - call used for example purposes thread.IsBackground = false; // Createa new ThreadStartData object to configure the thread ThreadStartData config = new ThreadStartData(5, "A thread example.", ... a WaitSleepJoin state and wait for any one of the objects in a WaitHandle array to be signaled You can also specify a timeout value WaitAll 178 Description A static method that causes the calling...
... Forms application (recipe 7-13) • Create forms thatcannotbemoved and create borderless forms that can bemoved (recipes 7-14 and 7-15) • Create an animated system tray icon for your application ... write XML, create an XmlWriter that wraps a stream and use Write methods (such as WriteStartElement and WriteEndElement) To read XML, create an XmlReader that wraps a stream, and call Read to move ... will indicate each error: Validating ProductCatalog_Invalid.xml Validation error: The 'expiryDate' element has an invalid value according to its data type [path information truncated] Validation...
... Create an irregularly shaped form or control (recipe 8-3) • Createa sprite that can bemoved around (recipe 8-4) • Display an image that could be made to scroll (recipe 8-5), learn how to capture ... Iterate through all font families int offset = 10; foreach (FontFamily family in fontFamilies.Families) { try { // Createa label that will display text in this font Label fontLabel = new Label(); ... growing and shrinking on the page The drawing logic takes place in the Form. Paint event handler, and a timer invalidates the form in a preset interval so that the image can be redrawn The user can...
... // Create the data set DataSet dataset = new DataSet(); 469 CHAPTER ■ DATABASE ACCESS // Create the SQL data adapter SqlDataAdapter adapter = new SqlDataAdapter(query, con); // Create the command ... // Create the data set DataSet dataset = new DataSet(); // Create the SQL data adapter SqlDataAdapter adapter = new SqlDataAdapter(query, con); // Create the command builder so we can modifications ... System.Data.DataSet class contains one or more instances of System.Data.DataTable, each of which contains instances of System.Data.DataRow, representing data rows from the database The SqlDataAdapter...
... RIPEMD160Managed 160 SHA or SHA1 SHA1CryptoServiceProvider 160 SHA1Managed SHA1Managed 160 SHA256 or SHA-256 SHA256Managed 256 SHA384 or SHA-384 SHA384Managed 384 SHA512 or SHA-512 SHA512Managed 512 Although ... command-line argument HashAlgorithm hashAlg = null; if (args[0].CompareTo("SHA1Managed") == 0) { hashAlg = new SHA1Managed(); } else { hashAlg = HashAlgorithm .Create( args[0]); } using (hashAlg) ... pass the class name as parameter to the factory; instead, you pass the algorithm name Once you have a HashAlgorithm object, its ComputeHash method accepts a byte array argument containing plain...
... event argument classes.) namespace Apress.VisualCSharpRecipes.Chapter13 { // An event argument class that contains information about a temperature // change event An instance of this class is passed ... TemperatureChangeEventArgs argument contains data about the old and new temperature values namespace Apress.VisualCSharpRecipes.Chapter13 { // A delegate that specifies the signature that all temperature event ... defines a type called MyDataType, which has a constructor and a method called sayHello The Main method called when the application starts creates an instance of MyDataType using eager initialization,...
... cvsSurface_Drop(object sender, DragEventArgs e) { // Createa new Label Label newLabel = new Label(); newLabel.Content = e.Data.GetData(DataFormats.Text); newLabel.FontSize = 14; // Add the Label ... createa gradient axis that starts or ends outside the area being filled You can also define a gradient axis that starts or ends somewhere inside the body of the area being filled Where the gradient ... Figure 17-21 Examples of simple and complex shapes on a canvas 17-24 Create Reusable Shapes Problem You need to createa shape that you can use many times without having to define it each time Solution...
... Create an irregularly shaped form or control (recipe 8-3) • Createa sprite that can bemoved around (recipe 8-4) • Display an image that could be made to scroll (recipe 8-5), learn how to capture ... Iterate through all font families int offset = 10; foreach (FontFamily family in fontFamilies.Families) { try { // Createa label that will display text in this font Label fontLabel = new Label(); ... growing and shrinking on the page The drawing logic takes place in the Form. Paint event handler, and a timer invalidates the form in a preset interval so that the image can be redrawn The user can...
... // Create the data set DataSet dataset = new DataSet(); 469 CHAPTER ■ DATABASE ACCESS // Create the SQL data adapter SqlDataAdapter adapter = new SqlDataAdapter(query, con); // Create the command ... // Create the data set DataSet dataset = new DataSet(); // Create the SQL data adapter SqlDataAdapter adapter = new SqlDataAdapter(query, con); // Create the command builder so we can modifications ... System.Data.DataSet class contains one or more instances of System.Data.DataTable, each of which contains instances of System.Data.DataRow, representing data rows from the database The SqlDataAdapter...
... RIPEMD160Managed 160 SHA or SHA1 SHA1CryptoServiceProvider 160 SHA1Managed SHA1Managed 160 SHA256 or SHA-256 SHA256Managed 256 SHA384 or SHA-384 SHA384Managed 384 SHA512 or SHA-512 SHA512Managed 512 Although ... command-line argument HashAlgorithm hashAlg = null; if (args[0].CompareTo("SHA1Managed") == 0) { hashAlg = new SHA1Managed(); } else { hashAlg = HashAlgorithm .Create( args[0]); } using (hashAlg) ... pass the class name as parameter to the factory; instead, you pass the algorithm name Once you have a HashAlgorithm object, its ComputeHash method accepts a byte array argument containing plain...
... event argument classes.) namespace Apress.VisualCSharpRecipes.Chapter13 { // An event argument class that contains information about a temperature // change event An instance of this class is passed ... TemperatureChangeEventArgs argument contains data about the old and new temperature values namespace Apress.VisualCSharpRecipes.Chapter13 { // A delegate that specifies the signature that all temperature event ... defines a type called MyDataType, which has a constructor and a method called sayHello The Main method called when the application starts creates an instance of MyDataType using eager initialization,...
... // A private class used to pass initialization data to a new thread private class ThreadStartData { public ThreadStartData(int iterations, string message, int delay) { this.iterations = iterations; ... default - call used for example purposes thread.IsBackground = false; // Createa new ThreadStartData object to configure the thread ThreadStartData config = new ThreadStartData(5, "A thread example.", ... a WaitSleepJoin state and wait for any one of the objects in a WaitHandle array to be signaled You can also specify a timeout value WaitAll 178 Description A static method that causes the calling...
... cultureNativeNameLabel.Text = CultureInfo.CurrentCulture.NativeName; } // Sample data that might come from a database // displayed according to culture set by user dateLabel.Text = DateTime.Now.ToString("D"); ... culture-specific operations Fortunately, NET provides a collection of classes which makes this relatively easy The System.Globalization namespace contains classes that specify culture-related information These ... server and store it to a session variable when the client logs in or on an ad-hoc basis No matter how the culture information is stored, it needs to be made available to the server as the client navigates...
... Windows Forms application, Visual Studio 2005 actually generates a potentially large amount of code This code performs operations such as creating and displaying the form when the application starts, ... Toolbox tab that appears to the left of the form in the Design View The Toolbox appears, partially obscuring the form and displaying the various components and controls that you can place on a Windows ... formA TextBox control is added to the form Move the TextBox control so that it is directly underneath the Label control TIP When you drag a control on a form, alignment handles appear automatically...
... to Create DataAdapter Objects 384 Lesson 4: Working with Data in DataTable Objects 385 Adding Data to a DataTable 385 Editing Data in a DataTable 386 Deleting Data in a DataTable ... DataView 410 Searching Data in a DataView 410 Navigating Related Data in a DataView 411 Working with DataView Events 411 Setting the DataTable Object’s Default Table Views Using a DataViewManager ... of thatform To add aform to your application at run time, declare and instantiate a variable that represents your form This example assumes that you have already designed aform named Form1 in...
... technologies that render HTML over a network You can createa client application with dumb terminals attached to a mainframe You can createa client application that runs from a command line in ... should be transparent and easy from a user’s perspective Running a ClickOnce-deployed application should be as easy to a user as going to a Web site, and should also be as easy as launching an application ... typically means an application that runs in a Web browser or as a special-purpose terminal that does not have a full end-user OS available Smart clients are first and foremost rich clients They are designed...
... containing the image from the database Createa SQL statement to retrieve the required image from the database and retrieve the image using a DataReader A DataTable or DataSet filled using a DataAdapter ... image from the database and serves it to the Image control on the web page that the client sees The following steps outline the required tasks: Createa web page that outputs a binary stream ... but not straightforward Fortunately, it is much simpler with ASP.NET than it was in ASP Two web pages are required: one that contains the user interface that the client sees and one that retrieves...
... if(!Page.IsPostBack) { dataGrid.DataSource = CreateDataSource( ); dataGrid.DataKeyField = "Id"; dataGrid.DataBind( ); } private DataTable CreateDataSource( ) { DataTable dt = new DataTable(TABLENAME); ... fills a DataTable with the TBL0705 table and stores the DataTable to a Session variable to cache the data source for the DataGrid UpdateDataSource( ) This method creates a DataAdapter and uses ... UpdateDataSource(DataTable dt) { // Createa DataAdapter for the update SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM " + TABLENAME + " ORDER BY Id", ConfigurationSettings.AppSettings["DataConnectString"]);...
... to the DataGrid The MappingName property of the DataGridTableStyle is set to the DataSource The MappingName of each DataGridColumnStyle object must be associated with the name of a DataColumn ... attributes, display format, and behavior of cells in a DataGrid column At runtime, each cell in the column hosts a DataGridTextBox control The DataGridBoolColumn inherits from the abstract DataGridColumnStyle ... DataGrid display column with the data column An exception will be thrown if duplicate mapping names are used The DataGridTextBoxColumn class inherits from the abstract DataGridColumnStyle class...