<?xml version='1.0' encoding='UTF-8'?>
<?xml-stylesheet type='text/css' href='../rootCSS/css1.css'?>
<html xmlns='http://www.w3.org/1999/xhtml'>
	<head>
		<title>C Sharp Notes</title>
	</head>
	<body>
		<ctitle class='webpage'>C Sharp Notes</ctitle>
		<section>
			<ctitle class='chapter'>References</ctitle>
			<ol>
				<li> ISBN 9780735626706, <em>Visual C# 2010 Step by Step</em>, by John Sharp, Microsoft Press 2010.</li>
				<li> ISBN 9781449394011, <em>C# 4.0 Pocket Reference (Pocket Reference (O'Reilly))</em>, by Ben Albahari, Joseph Albahari, O'Reilly Media 2010.</li>
			</ol>
		</section>
		<section>
			<ctitle class='chapter'>Aphorisms</ctitle>
			<ol>
<li><ctitle class='list'>The C# compiler <code>csc.exe</code>.</ctitle> <code>C:\Windows\Microsoft.NET\Framework\v4.0xxxx\csc.exe</code>. In Cygwin, the Scheme compiler has the exactly same name. The C# compiler compiles source code, specified as a set of files with the <code>.cs</code> extension, into an <em>assmbly</em>. An assembly is the unit of packaging and deployment in .NET. an assembly can be either an <em>application</em> or a <em>library</em>. A normal console or Windows application has a <code>Main</code> method and is an <code>.exe</code> file. A library is a <code>.dll</code> and is equivalent to an <code>.exe</code> without an entry point. Its purpose is to be called upon (referenced) by an application or by other libraries. The .NET Framework is a set of libraries. </li>
<li><ctitle class='list'>Syntax for library compilation.</ctitle> <code>csc /target:library Text.cs</code></li>
<li><ctitle class='list'>namespaces.</ctitle> Small programs can soon grow into much bigger programs As a program grows two issue arise. First, it is harder to understand and maintain big programs than it is to understand and maintain smaller programs. Second, more code usually means more names, more methods, and more classes. As the number of names increases, so does the [probability] of the project building failing because two or more names clash (especially when a program also uses third-party libraies written by developers who have also used a variety of names). In the past, programmers tried to solve the name-clashing problem by prefixing names with some sort of qualifier (or set of qualifiers). This solution is not a good one because it's not scalable; names become longer, and you spend less time writing software and more time typing (there is a difference) and reading and rereading incomprehensibly long names. Namespaces help solve this problem by creating a named container for other identifiers, such as classes. Two classes with the same name will not be confused with each other if they live in different namespaces. [ref=1]</li>
<li><ctitle class='list'>namespace convention in VS.</ctitle> VS 2010 environment uses the name of your project as the top-level namespace. The .NET Framework class library also adheres to this recommendation; every class in the .NET Framework lives inside a namespace.</li>
<li><ctitle class='list'>the <code>using</code> directive.</ctitle> If you have to write the full name (eg. <code>System.Console</code>) of a class every time you used it, the situation would be no better than prefixing qualifiers or even just naming the class with some globally unique name such as <i>SystemConsole</i> and not bothering with a namespace. You can solve this problem with a <em>using directive</em> in your programs. A <code>using</code> statement brings a namespace into <em>scope</em> and frees you from having to fully qualify the names of classes in your code.</li>
<li><ctitle class='list'>Defining a namespace.</ctitle> At the outermost level of a program, types are organized into namespaces. The using directive was used to make the namespace that follows it available to our application, to use all types inside it. We could define all our classes within the <code>TestPrograms</code> namespace, as followes,
<div>
<code class='block'>using System;</code>
<code class='block'>namespace TestProgram{</code>
<code class='block'><ind>class Test{...}</ind></code>
<code class='block'><ind>class Test2{...}</ind></code>
<code class='block'>}</code>
</div>
</li>
<li><ctitle class='list'>assemblies and references.</ctitle> An assembly is a file that usually has the <em>.dll</em> extension, although strictly speaking, executable programs with the <em>.exe</em> extension are also assemblies. An assembly can contain many classes. The classes that the .NET Framework class library comprises, such as <code>System.Console</code>, are provided in assemblies that are installed on your computer together with Visual Studio. You will find that the .NET Framework class library contains many thousands of classes. To enable piece wise update, the .NET class library is split into a number of assemblies by the functional area to which the classes they contain relation. You must add a reference to the specific assembly you want to use, then you can add a <code>using</code> directive to your code that bring the items in namespaces in that assembly into scope.</li>
<li><ctitle class='list'>assembly vs namespace</ctitle> There is not necessarily a 1:1 correspondence between an assembly and a namespace; a single assembly can contain classes for multiple namespaces. and a single namespace can span mutiple assemblies.</li>
<li><ctitle class='list'>WPF.</ctitle> VS 2010 provides two templates for building graphical applicaitons&#8212;the Windows Forms Application template and the WPF Applicaiton template. Windoes Forms is a technology that first appeared with the .NET Framework version 1.0. WPF, or <em>Windows Presentation Foundation</em>, is an enhanced technology that first appeared with the .NET Framework version 3.0. It provides many additional features and capabilities over Windows Forms.</li>
<li><ctitle class='list'>XAML.</ctitle> XAML stands for <em>Extensible Applicaiton Markup Language</em> and is an XML-like language used by WPF applicaitons to <em>define the layout</em> of a form and its <em>contents</em>.</li>
<li><ctitle class='list'>Main method of a WPF.</ctitle> The Main method for a WPF is in App.xaml.cs, but is hidden from view (notices the <code>partial</code> keyword. The hidden code performs operations such as creating and displaying the form, and creating and positioning the various controls on the form.</li>
<li><ctitle class='list'>Identifiers.</ctitle> Identifiers are names for classes, methods, variables, and so on. An identifier must be a whole word, essentially made up of Unicode characters starting with a letter or underscore. C# identifiers are case-sensitive. By convention, parameters, local variables, and private fields should be in camel case (e.g. myVariable), and all other identifiers should be in Pascal case (e.g. MyMethod).</li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
<li><ctitle class='list'></ctitle> </li>
			</ol>
		</section>
	</body>
</html>

