Web hosting uk - public static int Main(string[] args) { … //

February 26th, 2008

public static int Main(string[] args) { … // Get arguments using System.Environment. string[] theArgs = Environment.GetCommandLineArgs(); Console.WriteLine(”Path to this app is: {0}”, theArgs[0]); … } Specifying Command-Line Arguments with Visual Studio 2005 In the real world, the end user supplies the command-line arguments used by a given application when starting the program. However, during the development cycle, you may wish to specify possible command-line flags for testing purposes. To do so with Visual Studio 2005, double-click the Properties icon from Solution Explorer and select the Debug tab on the left side. From here, specify values using the Command line arguments text box (see Figure 3-2). CHAPTER 3 68 C# LANGUAGE FUNDAMENTALS An Interesting Aside: The System.Environment Class Let s examine the System.Environment class in greater detail. This class allows you to obtain a number of details regarding the operating system currently hosting your .NET application using various static members. To illustrate this class s usefulness, update your Main() method with the following logic: public static int Main(string[] args) { … // OS running this app? Console.WriteLine(”Current OS: {0} “, Environment.OSVersion); // Directory containing this app? Console.WriteLine(”Current Directory: {0} “, Environment.CurrentDirectory); Figure 3-2. Setting command arguments via Visual Studio 2005
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

CHAPTER 3 C# LANGUAGE FUNDAMENTALS 67 Figure (Web design tools)

February 25th, 2008

CHAPTER 3 C# LANGUAGE FUNDAMENTALS 67 Figure 3-1. Supplying arguments at the command line Processing Command-Line Arguments Assume that you now wish to update HelloClass to process possible command-line parameters: // This time, check if you have been sent any command-line arguments. using System; class HelloClass { public static int Main(string[] args) { Console.WriteLine(”***** Command line args *****”); for(int i = 0; i < args.Length; i++) Console.WriteLine("Arg: {0} ", args[i]); ... } } Here, you are checking to see if the array of strings contains some number of items using the Length property of System.Array (as you ll see later in this chapter, all C# arrays actually alias the System.Array type, and therefore have a common set of members). As you loop over each item in the array, its value is printed to the console window. Supplying the arguments at the command line is equally as simple, as shown in Figure 3-1. As an alternative to the standard for loop, you may iterate over incoming string arrays using the C# foreach keyword. This bit of syntax is fully explained later in this chapter, but here is some sample usage: // Notice you have no need to check the size of the array when using 'foreach'. public static int Main(string[] args) { ... foreach(string s in args) Console.WriteLine("Arg: {0} ", s); ... } Finally, you are also able to access command-line arguments using the static GetCommand- LineArgs() method of the System.Environment type. The return value of this method is an array of strings. The first index identifies the current directory containing the application itself, while the remaining elements in the array contain the individual command-line arguments (when using this technique, you no longer need to define the Main() method as taking a string array parameter):
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

Web and email hosting - CHAPTER 3 66 C# LANGUAGE FUNDAMENTALS Note

February 24th, 2008

CHAPTER 3 66 C# LANGUAGE FUNDAMENTALS Note C# is a case-sensitive programming language. Therefore, Main is not the same as main , and Readline is not the same as ReadLine . Given this, be aware that all C# keywords are in lowercase (public, lock, global, and so on), while namespaces, types, and member names begin (by convention) with an initial capital letter and have capitalized any embedded words (e.g., Console.WriteLine, System.Windows.Forms.MessageBox, System.Data.SqlClient, and so on). In addition to the public and static keywords, this Main() method has a single parameter, which happens to be an array of strings (string[] args). Although you are not currently bothering to process this array, this parameter may contain any number of incoming command-line arguments (you ll see how to access them momentarily). The program logic of HelloClass is within Main() itself. Here, you make use of the Console class, which is defined within the System namespace. Among its set of members is the static WriteLine() which, as you might assume, pumps a text string to the standard output. You also make a call to Console.ReadLine() to ensure the command prompt launched by Visual Studio 2005 remains visible during a debugging session until you press the Enter key. Because this Main() method has been defined as returning an integer data type, we return zero (success) before exiting. Finally, as you can see from the HelloClass type definition, C- and C++-style comments have carried over into the C# language. Variations on the Main() Method The previous iteration of Main() was defined to take a single parameter (an array of strings) and return an integer data type. This is not the only possible form of Main(), however. It is permissible to construct your application s entry point using any of the following signatures (assuming it is contained within a C# class or structure definition): // No return type, array of strings as argument. public static void Main(string[] args) { } // No return type, no arguments. public static void Main() { } // Integer return type, no arguments. public static int Main() { } Note The Main() method may also be defined as private as opposed to public. Doing so ensures other assemblies cannot directly invoke an application s entry point. Visual Studio 2005 automatically defines a program s Main() method as private. Obviously, your choice of how to construct Main() will be based on two questions. First, do you need to process any user-supplied command-line parameters? If so, they will be stored in the array of strings. Second, do you want to return a value to the system when Main() has completed? If so, you need to return an integer data type rather than void.
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

C# Language Fundamentals Consider this chapter a potpourri (Web hosting directory)

February 23rd, 2008

C# Language Fundamentals Consider this chapter a potpourri of core topics regarding the C# language and the .NET platform. Unlike forthcoming chapters, there is no overriding example or theme; rather, the following pages illustrate a number of bite-size topics you must become comfortable with, including value-based and reference-based data types, decision and iteration constructs, boxing and unboxing mechanisms, the role of System.Object, and basic class-construction techniques. Along the way, you ll also learn how to manipulate CLR strings, arrays, enumerations, and structures using the syntax of C#. To illustrate these language fundamentals, you ll take a programmatic look at the .NET base class libraries and build a number of sample applications, making use of various types in the System namespace. This chapter also examines a new C# 2005 language feature, nullable data types. Finally, you ll learn how to organize your types into custom namespaces using the C# namespace keyword. The Anatomy of a Simple C# Program C# demands that all program logic is contained within a type definition (recall from Chapter 1 that type is a term referring to a member of the set {class, interface, structure, enumeration, delegate}). Unlike in C(++), in C# it is not possible to create global functions or global points of data. In its simplest form, a C# program can be written as follows: // By convention, C# files end with a *.cs file extension. using System; class HelloClass { public static int Main(string[] args) { Console.WriteLine(”Hello World!”); Console.ReadLine(); return 0; } } Here, a definition is created for a class type (HelloClass) that supports a single method named Main(). Every executable C# application must contain a class defining a Main() method, which is used to signify the entry point of the application. As you can see, this signature of Main() is adorned with the public and static keywords. Later in this chapter, you will be supplied with a formal definition of public and static. Until then, understand that public members are accessible from other types, while static members are scoped at the class level (rather than the object level) and can thus be invoked without the need to first create a new class instance. 65 C H A P T E R 3
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

The C# Programming Language P A R T (Web proxy server)

February 23rd, 2008

The C# Programming Language P A R T 2
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.

Starting a web site - CHAPTER 2 62 BUILDING C# APPLICATIONS Table

February 22nd, 2008

CHAPTER 2 62 BUILDING C# APPLICATIONS Table 2-5. Select .NET Development Tools Tool Meaning in Life URL FxCop This is a must-have for any .NET http://www.gotdotnet.com/team/fxcop developer interested in .NET best practices. FxCop will test any .NET assembly against the official Microsoft .NET best-practice coding guidelines. Lutz Roeder s This advanced .NET decompiler/object http://www.aisto.com/roeder/dotnet Reflector for browser allows you to view the .NET implementation of any .NET type using CIL, C#, Object Pascal .NET (Delphi), and Visual Basic .NET. NAnt NAnt is the .NET equivalent of Ant, the http://sourceforge.net/projects/nant popular Java automated build tool. NAnt allows you to define and execute detailed build scripts using an XML-based syntax. NDoc NDoc is a tool that will generate code http://sourceforge.net/projects/ndoc documentation files for C# code (or a compiled .NET assembly) in a variety of popular formats (MSDN s *.chm, XML, HTML, Javadoc, and LaTeX). NUnit NUnit is the .NET equivalent of the http://www.nunit.org Java-centric JUnit unit testing tool. Using NUnit, you are able to facilitate the testing of your managed code. Vil Think of Vil as a friendly big brother http://www.1bot.com for .NET developers. This tool will analyze your .NET code and offer various opinions as to how to improve your code via refactoring, structured exception handling, and so forth. Note The functionality of FxCop has now been integrated directly into Visual Studio 2005. To check it out, simply double-click the Properties icon within Solution Explorer and activate the Code Analysis tab. Summary So as you can see, you have many new toys at your disposal! The point of this chapter was to provide you with a tour of the major programming tools a C# programmer may leverage during the development process. You began the journey by learning how to generate .NET assemblies using nothing other than the free C# compiler and Notepad. Next, you were introduced to the TextPad application and walked though the process of enabling this tool to edit and compile *.cs code files. You also examined three feature-rich IDEs, starting with the open source SharpDevelop, followed by Microsoft s Visual C# 2005 Express and Visual Studio 2005. While this chapter only scratched the surface of each tool s functionality, you should be in a good position to explore your chosen IDE at your leisure. The chapter wrapped up by examining a number of open source .NET development tools that extend the functionality of your IDE of choice.
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

CHAPTER 2 BUILDING (Disney web site) C# APPLICATIONS 61 example,

February 21st, 2008

CHAPTER 2 BUILDING C# APPLICATIONS 61 example, if you place the cursor on the Console class, the Dynamic Help window displays a set of links regarding the System.Console type. You should also be aware of a very important subdirectory of the .NET Framework 2.0 SDK documentation. Under the .NET Development ..NET Framework SDK.Class Library Reference node of the documentation, you will find complete documentation of each and every namespace in the .NET base class libraries (see Figure 2-29). Each book defines the set of types in a given namespace, the members of a given type, and the parameters of a given member. Furthermore, when you view the help page for a given type, you will be told the name of the assembly and namespace that contains the type in question (located at the top of said page). As you read through the remainder of this book, I assume that you will dive into this very, very critical node to read up on additional details of the entity under examination. A Partial Catalogue of Additional .NET Development Tools To conclude this chapter, I would like to point out a number of .NET development tools that complement the functionality provided by your IDE of choice. Many of the tools mentioned here are open source, and all of them are free of charge. While I don t have the space to cover the details of these utilities, Table 2-5 lists a number of the tools I have found to be extremely helpful as well as URLs you can visit to find more information about them. Figure 2-29. The .NET base class library reference
If you are looking for cheap and quality webhost to host and run your website check Jboss Web Hosting services.

CHAPTER 2 60 BUILDING C# APPLICATIONS To (Web hosting solutions)

February 20th, 2008

CHAPTER 2 60 BUILDING C# APPLICATIONS To complete this example, update the generated SportsCar class with a public method named PrintPetName() as follows: public class SportsCar : Car { public void PrintPetName() { petName = “Fred”; Console.WriteLine(”Name of this car is: {0}”, petName); } } Object Test Bench Another nice visual tool provided by Visual Studio 2005 is Object Test Bench (OTB). This aspect of the IDE allows you to quickly create an instance of a class and invoke its members without the need to compile and run the entire application. This can be extremely helpful when you wish to test a specific method, but would rather not step through dozens of lines of code to do so. To work with OTB, right-click the type you wish to create using the Class Designer. For example, right-click the SportsCar type, and from the resulting context menu select Create Instance .Sports- Car(). This will display a dialog box that allows you to name your temporary object variable (and supply any constructor arguments if required). Once the process is complete, you will find your object hosted within the IDE. Right-click the object icon and invoke the PrintPetName() method (see Figure 2-28). Figure 2-28. The Visual Studio 2005 Object Test Bench You will see the message Name of this car is: Fred appear within the Visual Studio 2005 Quick Console. The Integrated Help System The final aspect of Visual Studio 2005 you must be comfortable with from the outset is the fully integrated help system. The .NET Framework 2.0 SDK documentation is extremely good, very readable, and full of useful information. Given the huge number of predefined .NET types (which number well into the thousands), you must be willing to roll up your sleeves and dig into the provided documentation. If you resist, you are doomed to a long, frustrating, and painful existence as a .NET developer. Visual Studio 2005 provides the Dynamic Help window, which changes its contents (dynamically!) based on what item (window, menu, source code keyword, etc.) is currently selected. For
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.

CHAPTER 2 (Web hosting support) BUILDING C# APPLICATIONS 59 By

February 19th, 2008

CHAPTER 2 BUILDING C# APPLICATIONS 59 By way of example, drag a new class from the Class Designer Toolbox onto your Class Designer. Name this class Car in the resulting dialog box. Now, using the Class Details window, add a public string field named petName (see Figure 2-26). If you now look at the C# definition of the Car class, you will see it has been updated accordingly: public class Car { // Public data is typically a bad idea; however, // it keeps this example simple. public string petName; } Add another new class to the designer named SportsCar. Now, select the Inheritance icon from the Class Designer Toolbox and click the top of the SportsCar icon. Without releasing the left mouse button, move the mouse on top of the Car class icon. If you performed these steps correctly, you have just derived the SportsCar class from Car (see Figure 2-27). Figure 2-26. Adding a field with the Class Details window Figure 2-27. Visually deriving from an existing class
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Web hosting contract - This utility works in conjunction with two other

February 18th, 2008

This utility works in conjunction with two other aspects of Visual Studio 2005: the Class Details window (activated using the View .Other Windows menu) and the Class Designer Toolbox (activated using the View . Toolbox menu item). The Class Details window not only shows you the details of the currently selected item in the diagram, but also allows you to modify existing members and insert new members on the fly (see Figure 2-24). CHAPTER 2 58 BUILDING C# APPLICATIONS The Class Designer Toolbox (see Figure 2-25) allows you to insert new types into your project (and create relationships between these types) visually. (Be aware you must have a class diagram as the active window to view this toolbox.) As you do so, the IDE automatically creates new C# type definitions in the background. Figure 2-23. The Class Diagram viewer Figure 2-24. The Class Details window Figure 2-25. Inserting a new class using the visual Class Designer
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.