MCTS 70-536-CSHARP Short Notes

Developing applications that use system types and collections

  • Use the CausesValidation property of the ImageButton class to set a value to indicate whether validation is performed on a Web server control when an ImageButton control is clicked.
  • Installation packages are created for deploying a Web application by using a Web Setup project. A merge module project is used for components to be added to the application.
  • Use the Web Setup project and Deployment project to create installation packages for the deployment of Web-based applications such as XML Web services, Web applications etc., to a Web server.
  • Use a RequiredFieldValidator control to check whether or not an input control contains a value.
  • Use a RegularExpressionValidator control to check whether or not the value entered into a form field matches the pattern specified by a regular expression.
  • Use the validation error messages to be displayed on a Web page in a message box by setting the ShowMessageBox property of the ValidationSummary control to true. By setting the ValidationSummary property of the ValidationSummary control to false, the validation summary will not be displayed on the Web page.
  • Create and sort an array of data using the System namespace.
  • Use the FileStream class to read and write data to and from the file.
  • Develop a .NET application that displays a list of all the prices of a company’s products and during the execution a nonfatal error is encountered, which is handled by SystemException class.
  • Create an application and identify differences between a class and a structure.
  • Create a simple code that stores a constant in a double data type and performs simple prefix and postfix increment and decrement operations.
  • Use the ControlToValidate property of the BaseValidator class to specify the input control to validate data. The IsValid property of the IValidator class determines whether the associated input control passes validation.
  • Use the MergeStyle method of the WebControl class to apply non-blank elements of the specified style to a Web control without overwriting the existing style elements of the control.
  • Use the IsValid property of the CustomValidator control to indicate whether or not an input control passes validation.
  • Develop an application to provide a customized control layout in the DataGrid control by using the TemplateColumn column type of the DataGrid class.
  • Use a Web user control to create a control using the same technique, which is used in the creation of Web form pages.
  • Use the Anchor property of the Button control so that they maintain a specific distance relative to the bottom and right edges of the form.
  • Use the ListBox control to add ListBox to the Controls collection of a form and use either the Add method or the AddRange method of the Control.ControlCollection class.
  • Create a Web page and add two RadioButton controls and ensure that users can select only one of the two RadioButtons at a time.
  • Identify that the controls do not provide a user interface, i.e., they are controls that do not appear to the user but provide the functionalities required by an application.
  • Add two RequiredFieldValidator controls and place the RequiredFieldValidator controls and also add a ValidationSummary control at the bottom of the page.
  • Implementing properties of the validation controls.
  • Use ImageUrl, Text, and ToolTip properties of a MyHyperLink control.
  • Use the AccessKey property of a Web server control to specify the access key for the control. This property can be set to only a single character string.
  • Use a Web page to be converted to a user control via code
  • Use the AlternateText property of an Image control to specify an alternate text to display in the Image control. This text is displayed in the Image control when the image specified by the ImageUrl property is not available.
  • Create an ASP.NET application that contains a page. The page contains several TextBox controls that accept users’ input and uses several validation controls on the page to validate input controls.
  • Use the EnableSessionState attribute in the @ Page directive to define session-state requirements for a Web page.
  • Use the ASP .NET controls by settings of sub-properties by specifying a “”-“” special syntax. The “”-“” syntax between the attribute and the property denotes a sub-property.
  • Use the ArrayList class of the System.Collections namespace, which implements the IList interface by using an array of data.
  • Develop a Console application and add names of recently recruited employees to a SortedList object and retrieve the index number of an employee.
  • Create an application using Hashtable class, declare a Hashtable object and retrieve values to their corresponding keys stored in the Hashtable object.
  • Use the Dequeue method of the Queue class to retrieve as well as remove an item at the beginning of a queue.
  • Use the ApplyStyle method of the WebControl class to apply any non-blank element of the specified style to a Web control. It also overwrites the existing style elements of the control.
  • Use the following code segment to secure a method from unauthorized users:
    GenericIdentity GenIdentity = new GenericIdentity(“”Generic””, “”Custom””);
    string[] GeoRoles = {“”GeoSurvey””};
    GenericPrincipal GeoPrincipal = new GenericPrincipal(GenIdentity, GeoRoles);
    Thread.CurrentPrincipal = GeoPrincipal;
  • Use the CompareTo method of the IComparable generic interface returns a 32-bit signed integer value that indicates the relative order of the objects that is to be compared.
  • Create a Windows application and use the IComparer generic interface to provide better type safety and performance than non-generic interface.
  • Create a Console application using the System.Generic namespace and implement the queue class.
  • Create a Console application to implement the stack class by using the System namespace and System.Collection namespace.
  • Use the Specialized Dictionary classes and interfaces Named collections, CollectionsUtil, and BitVector32 and BitVector32.Section structures to develop an application.
  • Create an array of data containing user’s session and use the Session object for data storage. If the Session object is enabled, only users of a particular session will be redirected to other Web pages to view them. The server destroys the session object when the session of a user expires.
  • Create a Console application that implements and use a structure.
  • Create an application to manage collections and to select a class that is optimized for key-based item retrieval from both small and large collections using Hybrid Dictionary.
  • Use string concatenation to gather data from multiple email messages and format the data for display on the page and ensure that the page displays the data as quickly as possible.
  • Implement interfaces belonging to the System namespace in your application code using the TreeView window.
  • Create a Console application and work with default and parameterized constructor in the application.
  • Create a console application that has three Main() method implementations and handle these methods.
  • Create a Web application with two text boxes and specify that the text typed in TextBox1 also appears in TextBox2 simultaneously by using the TextChanged event of a TextBox control.
  • Use the ProductIDControl_TextChanged event handler to execute when the TextChanged event of ProductIDControl is raised. The TextChanged event of the TextBox control occurs when the Text property value is changed.
  • Use the Click event of the Button control and TextChanged event of the TextBox control to convert lower case letters to upper case.
  • Develop an ASP.NET application that contains a DataGrid control. Each row in the DataGrid contains ten Label controls and an Edit button. The Label controls are read-only and are used to display purchase order information. Make sure that the Label controls are changed to TextBox controls when users click the Edit button by using the EditItemIndex property of the DataGrid control.
  • Create an ASP.NET page and add a TextBox control to it and ensure that if a user enters any lowercase letter in the text box, it must convert to uppercase as soon as the user moves out of the text box.
  • Create an ASP.NET application and a List, TextBox control to it and ensure that as soon as users select a product from the list, the text boxes are filled with the information about the selected product, and also ensure that users can select only a single product at a time.
  • Use the ItemDataBound event of the DataGrid control, when an item is data bound to the DataGrid control.
  • Use the StackTrace property to trace a stack at runtime. It is an ordered collection of one or more stack frames.
  • Create an event that invokes a delegate.
  • Use the PrintPageEventArgs class to provide data for the PrintPage event and it occurs when the output for the current page is needed.
  • Use the CausesValidation property of a Button control to enable or disable validation when the Button control is clicked.
  • Implementing service processes, threading, and application domains in a .NET Framework application

  • Use the cache classes to implement the cache for a Web application and add to the Cache object.
  • Use the VaryByParam attribute of the @ OutputCache directive to vary user control output cache by specifying user control name and parameter.
  • Use a Cache object to implement the cache for a Web application. The Session object pertains to an individual user’s session with an application. It is used to store and retrieve information during a specific session for a user.
  • Use the SetVaryByCustom() method of the HttpCachePolicy class to specify a custom text string to vary the cached output responses.
  • Develop an application and use the Installutil tool to install the application, and choose the appropriate predefined installer classes.
  • During the Manual registration, the assembly fails to load, error type occurs, due to which the error message that describes the reason for the failure is displayed as output.
  • Running installation process under a specific account.
  • Create an application and implement multiple threads using WaitCallBack delegate.
  • Create a Console application and add a class file in the application that handles exceptions.
  • Use the System.Threading namespace to create a thread and execute it.
  • Write a code that creates a thread using the System.Threading namespace.
  • Write a code in an application to create a thread and run it. After completing the application, execute the application. The application executes successfully and gives the result according to the code. Now, run the thread in the background.
  • Create a Console application and implement System.Threading namespace to work with the Timer class.
  • Use the System.Threading namespace to work with Timer class and other classes related to Timer class.
  • Use the Semaphore class to provide the facility to access the resources concurrently. It is also used for synchronization.
  • Use the Mutex class to synchronize access to a protected resource with the WaitOne(), WaitAll(), and WaitAny() methods.
  • Use the Regsvcs.exe tool to load and register assemblies as well as generate, register, and install a type library into a COM application.
  • Develop an application for the Production Manager of a company and deploy the application on the production computer, so that information is distributed to restricted users.
  • Create an application to run an assembly within an application domain.
  • Embedding configuration, diagnostic, management, and installation features into a .NET Framework application

  • Create a Windows application and register it on the computer by using the Process.Start method.
  • Use the Demand() method to decide at runtime whether all callers in the call stack have been granted the permission specified by a current permission object by implementing class library.
  • Create an application configuration file to install a file on a client computer along with an application and ensure that the settings in the application configuration file are applied.
  • Configure a .NET Framework application by using the .NET Framework Configuration tool (Mscorcfg.msc). ManagedInstallerClass, InstallContext, InstallerCollection classes, InstallEventHandler delegate and Configure concurrent garbage collection. Register remote objects by using configuration files.
  • Deploying shared assemblies with binding policy that is a set of rules to determine the place to search for the assembly and version to bind to the application.
  • Develop and deploy an application on the production computer. The application references a new version 2.0.0.0 of an assembly. When the application starts its execution, the Common Language Runtime (CLR) locates and binds the assembly to the application.
  • Develop an application to install an application on a target computer and add installation components to the application.
  • Use the EventLog class to interact with Windows event logs and use the Source property of the EventLog class to specify the source name to register and use when writing to the event log.
  • Use the CreateEventSource() method of the EventLog class to create an event if the event log does not already exist and register a Web service with this event log.
  • Use the CreateEventSource method of the EventLog class to establish an application as a valid event source for writing event information to a particular event log on a computer.
  • Develop an application to log important information of the application while it is executing and to write message text to the event log.
  • Perform an integration testing for an application and ensure that when the Write() method of the Debug class or the Trace class is called, each time only one entry is added to the event log.
  • Use the Process class to execute an application and open the Microsoft word application, and print the opened Microsoft Word document application.
  • Working with the Process class to open an application.
  • Examine the current value of variables and objects in scope of each line of code and complete the debugging process as quickly as possible and see the value of global variables by using the Watch window.
  • Use the Assert method of the Trace class to check for a condition and display a message if the condition is false.
  • Create a client-activated .NET Remoting object to ensure that an object logs error and warning messages to a log file and Windows application log.
  • Use the Assert method of the Trace class to check for a condition and display a message if the condition is false.
  • Use the Trace.Fail method of the System.Diagnostics to emit an error message unconditionally.
  • Use Regression testing to make sure that no new errors are found. Regression testing can be performed any time when a program needs to be modified either to add a feature or to fix an error.
  • Use the trace switch object that filters tracing output messages and use the WriteLineIf statement of the Trace class to test the switch to trace either error messages or warning messages.
  • Create an application. Before deploying the application on the production computer, test and debug it, so that it is free from defects. Therefore, develop a test plan according to which the application is to be tested.
  • Use the Cordbg.exe tool to debug the application from a command prompt. Runtime Debugger (Cordbg.exe) is a tool that provides command-line debugging services.
  • Use the WriteLineIf() method of the Debug class to write a message with a new line character to the trace listeners in the Listeners collection if a condition is true.
  • Use the Autos debugging window to view a list of currently active procedure calls. It displays values of all variables within the scope of the current statement and previous statement of the currently executing procedures.
  • Displaying output tracing messages by implementing the Log() method of the Debugger class.
  • Debugging the Web forms by unchecking the Disable Script Debugging check box.
  • Use the TraceSwitch class within code and whenever the code uses Trace logging, the code consults with the TraceSwitch level to verify whether or not to log information.
  • Implementing serialization and input/output functionality in a .NET Framework application

  • Use the BinaryFormatter class and FileStream class for serialization to serialize and deserialize an object.
  • Use the Namespace property of the DataSet object to specify the namespace of a DataSet object. Namespace specifies XML attributes, elements, and the root element of an XML document when it is read into a DataSet object.
  • Use the DeleteRule property of the ForeignKeyConstraint class to specify the action that is to occur when a row is deleted.
  • Use the WriteXml(string, XmlWriteMode) method of the DataSet class to write XML schema and data from a DataSet object in XML format.
  • Use the XmlDocument class that is defined within the System.Xml namespace to represents an XML document and create an in-memory tree object containing an XML hierarchical node structure and related data.
  • Use the XmlDocument class that is defined within the System.Xml namespace, to represent an XML document.
  • Use the Load method of the XmlDocument class to load the XML document in the memory stream. The ImportNode method of the XmlDocument class is used to import the node from another XML document.
  • Write an XML Schema for a DataSet and store its structure to an XML document and to retain only the structure of the DataSet object.
  • Use an element to specify that a value of an attribute or element must be unique within the specified scope. Use the name attribute of the element to define the name of the unique element.
  • Use a element to contain an XML Path Language (XPath) expression and specify that the location in which the values are specified must be unique. Use the element to specify the field on which the values must be unique.
  • Use an XmlReader class to display the XML file from a database. The Read method is implemented in order to read data from the XML file.
  • Develop an application and create a custom class to serialize its objects, and store objects into an XML file.
  • Create a class and implement XML objects to handle XML data.
  • Use the SoapUnknownHeader class to handle data received from a SOAP header but not understood by any recipient Web service.
  • While defining and processing SOAP headers, a class representing data in a particular SOAP header needs to be defined. The class must be derived from the SoapHeader class.
  • Use MemberName property of the SoapHeaderAttribute class to specify the member of the XML Web service that represents the SOAP header contents.
  • Create a proxy class for a Web service manually and create methods for calling the XML Web service method asynchronously using Wsdl.exe tool.
  • Develop an application and use the CopyTo method of the FileInfo class to copy an existing file to a new file.
  • Create an application for monitoring a directory for any kind of changes by using System.IO namespace.
  • Develop an application and implement the FileInfo class to read data from a file.
  • Manage the .NET Framework application data by using Reader and Writer classes.
  • Manage the .NET Framework application data by using StringReader, StringWriter, TextReader, TextWriter, StreamReader, StreamWriter classes, BinaryReader and BinaryWriter classes.
  • Use the Path class to get the file extension using the GetExtention() method and to change the file extension using the ChangeExtention() method.
  • Implement the Trace class to log any errors thrown by an application and direct the Trace output to a local log file.
  • Create a Console application and store some characters into an array of Unicode characters and write these characters into a String object.
  • Compress or decompress stream information in a .NET Framework application using System.IO.Compression namespace.
  • Improve the security of application data by using isolated storage by using IsolatedStorageFile, IsolatedStorageFileStream, DeflateStream, and GZipStream classes.
  • Improving the security of the .NET Framework applications by using the .NET Framework 2.0 security

  • Use the utilities for the verification of the security policy to deploy an application, such as Caspol.exe, Preverify.exe, and Permview.exe utilities.
  • Use ComponentAccessControl, ApplicationAccessControl, SecureMethod, and SecurityRole attributes to configure security of a COM component.
  • Deploy an application to the client computers on a company’s intranet. Later, modify the assembly, any application that uses version 1.0 must now use version 2.0 by using PublisherPolicy.
  • Create an assembly that is consumed by other application and permission not granted to an assembly without minimum permission request.
  • Use the Code Access Security Policy tool (Caspol.exe) to enable users and administrators to modify the security policy for the machine policy level, the user policy level, and the enterprise policy level.
  • Use the FileAuthorizationModule module, when the authentication mode attribute in the element is set to Windows.
  • Use the username and password attributes in the element of the Web.config file for every request on a Web page.
  • Use the Windows authentication provider to authenticate users on the basis of their Windows accounts.
  • Use Basic authentication to authenticate users on the Internet and enable a browser to prompt the user for a username and password.
  • Use the element in the Web.config file to identify users to view an ASP.NET application.
  • Create a Web application that does not allow anonymous users to access the application by setting the users attribute of the element to “”?””.
  • Use the CookieMode property to set one of the values of the HttpCookieMode enumeration.
  • Use the attribute in the Web.config file of the application to deny access to a resource. The users attribute of the element specifies the user names that are denied access to a resource.
  • Use the element to configure ASP.NET authorization support. It contains elements and sub elements. These sub elements are used to allow or deny access to a resource based on specific users or roles.
  • Use the timeout attribute of authentication to specify an integer value that denotes the time (in minutes).
  • Use the slidingExpiration attribute of authentication to specify that the session timeout is periodically reset as long as a user stays active on the site.
  • Use the Packet Privacy authentication level to authenticate and encrypt data. This level includes data integrity and the identity and signature of a user.
  • Use the Custom Authentication with SOAP headers, which is suitable for both secure and non-secure Internet scenarios. For user authentication, the user credentials in encrypted format are passed within the SOAP header of the SOAP message.
  • Use the NegotiateStream class of the System.Net.Security namespace to provide a stream that uses the Negotiate security protocol for a client authentication.
  • Use the SslStream class of the System.Net.Security namespace to provide a stream that uses the Secure Socket Layer (SSL) security protocol to authenticate the server and optionally a client.
  • Encrypt, decrypt, and hash data by using the System.Security.
  • Use the TripleDESCryptoServiceProvider class to encrypt data in a file as well as in the memory.
  • Create code that randomly rolls the dice fifty times, and displays the results on the screen by using RNGCryptoServiceProvider class.
  • Use the key lengths of 384 bits to 16384 bits to encrypt and decrypt data by using RSACryptoServiceProvider class.
  • Use the IsSubSetOf method of the PrincipalPermission class to determine whether or not the current permission object is a subset of the specified permission object.
  • Use the IsSubSetOf method of the PrincipalPermission class to determine whether or not the current permission object is a subset of the specified permission object.
  • Use the PrincipalPermissionAttribute class or method to declaratively demand that users running code within the class or method belong to a specified role or have been authenticated.
  • Use the Union method of the PrincipalPermission class to create a permission object that is the union of the current permission object and a target parameter permission object.
  • Use the Control code privileges by using System.Security.Policy classes.
  • Access and modify identity information by using the System.Security.Principal classes.
  • Use the Windows NT ChallengeResponse authentication to provide the highest security. It uses a cryptographic exchange of passwords in encrypted form instead of transmitting them as clear text on the Internet.
  • Use Session object to create a variable that will be available as long as the session is active. The Session object pertains to an individual user’s session with the Web service.
  • Implement role-based authorization using GenericPrincipal class to represent the roles of the current user.
  • Implementing interoperability, reflection, and mailing functionality in a .NET Framework application

  • Use the ComVisible attribute to specify whether or not a class or interface is visible in COM.
  • Use the ServicedComponent class that is the base class of the classes that use COM services. It is defined in the System.EnterpriseServices namespace. A serviced component is a .NET component that uses component services of COM, such as object pooling, transaction management, etc.
  • Use Visual Studio 2005 IDE and Tlbimp.exe tool to import a COM type library to the Microsoft .NET Framework.
  • Deploying an assembly on COM application to a client computer using the Assembly Registration Tool (Regasm.exe) and register the file on the client computer.
  • Deploy a Client and a component to a single folder on multiple client computer by using COM Type Libraries.
  • Use the Web References dialog box to refer to XML Web services published on either a local intranet or the Internet.
  • Use the Type Library Importer (Tlbimp.exe) tool to convert the type definitions from a COM type library into equivalent definitions in a common language runtime assembly.
  • Use the element to specify that an application configures the channel through which it communicates with remote objects. A new channel, which is not a channel template, can also be declared and configured.
  • Use the Regsvr32.exe tool to register or unregister dynamic-link libraries (DLLs) and ActiveX controls (OCX) in the Windows Registry.
  • Use the SecurityRole attribute of the [assembly] element to allow the COM security configuration for the library or server application.
  • Use the Common Language Runtime to find the assembly through the codebase setting. If no match is found in the location as specified in the element in the application configuration file, the binding request fails. Then the CLR tries to find the assembly through probing.
  • Deploy an application and provide the Common Language Runtime (CLR) runtime services to the application during its execution.
  • Use the element to use a client application that can test an object.
  • Use the Sn.exe tool to sign assemblies with strong names. It also provides signature generation, signature verification, and key management.
  • Use the Signcode.exe tool to sign a portable executable file for a component or an assembly with an Authenticode digital signature.
  • Use a method in an application code and the method of the Assembly class to load and examine many assemblies having the same identity but located in different paths.
  • Send e-mail to a Simple Mail Transfer Protocol (SMTP) server for delivery from a .NET Framework application.
  • Develop an application and use Secure Sockets Layer (SSL) protocol before application is sent to remote computer using WebResponse and WebRequest classes.
  • Create an application to send an e-mail message, use a SMTP server available on the local subnet. To test the application, use a source address and a target address.
  • Implementing globalization, drawing, and text manipulation functionality in a .NET Framework application

  • Use the culture attribute of the globalization section to specify the default culture for processing incoming requests from the Web site.
  • Use the ResourceManager class to provide access to culture-specific resources at runtime.
  • Use the CultureInfo class to represent information about a specific culture including the language, the writing system, the calendar used etc.
  • Use the InvariantCulture property of the CultureInfo class, which is culture-independent and is not associated with any specific country or region.
  • Develop an application for users who live in Australia and format pattern for positive currency values by implementing CurrencyPositivePattern property of the NumberFormatInfo class.
  • Develop an application for a client residing in Australia and display negative currency values by using a minus sign using CultureInfo class.
  • Gather regional information about customers in a particular country by implementing RegionInfo class.
  • Create a Windows application to generate a report that lists language and region code.
  • Use an application to detect the current culture of the user requesting the application.
  • Make application accessible to low vision users by using the AccessibleName property to the accessibility aids (accessibility aids are specialized programs and devices, such as the Braille bar that help the users with disabilities to use computers more effectively).
  • Use the license agreement to store contents in the Rich Text Format (RFT) file and add the file to a setup project and also enhance user interface with license agreement policy.
  • Enhance User Interface using BackColor property to set the background color to transparent.
  • Use the Bitmap class constructs to a new Bitmap from a file, using the SetPixel() method to recolor an image and use the SetPixel() method of a Bitmap class to set the color of the specified pixels.
  • Implement a PictureBox control and use appropriate parameter in the DrawLine() method to draw the line successfully on the PictureBox control.
  • Create a Windows application and use the FillRectangle() method to fill the rectangle.
  • Create a Windows application to work with the ColorConverter class.
  • Create a method, in which construct an Icon and call the ToBitmap() method to convert it to bitmap, and draw the bitmap using the DrawImage() method.
  • Create a method to work with the Pen class.
  • Write a code in a method that draws two rectangles on a PictureBox control and fills the interior of both rectangles with the SolidBrush.
  • Display statistical date in a graphical format and use a custom graphing control that does not support resizing and ensure that users cannot resize, minimize, or maximize Form.
  • Enhance the text handling capabilities of a .NET Framework application by using System.Text namespace.
  • Use the StringBuilder class to represent dynamic or mutable string of characters, it represents a string-like object whose value is changeable.
  • Create a Unicode string that is outside the range of ASCII and encode the Unicode string by using the ASCIIEncoding.
  • Implement both Encoder class and Encoding class to encode characters.