Commits

Anonymous committed 4c0865d

first C# program

Comments (0)

Files changed (5)

+syntax: regexp
+\.pdb$
+\.exe$
+/Debug/

console/Program.cs

+using System;
+
+namespace console
+{
+	class Program
+	{			
+		public static void Apples(int x)
+		{
+			if(x == 0)
+			{
+				Console.WriteLine("No apples");
+			}
+			else if(x == 1)
+			{
+				Console.WriteLine("one apple");
+			}
+			else
+			{
+				Console.WriteLine(x + " apples.");
+			}
+			//
+			switch(x)
+			{
+				case 0:
+					Console.WriteLine("No apples");
+					break;
+				case 1: 					
+					Console.WriteLine("one apple");
+					break;
+				default:
+					Console.WriteLine(x + " apples.");
+					break;
+			}
+		}
+		
+		public static double Power5(double x)
+		{
+			double x2 = x * x;
+			double x4 = x * x;
+			return x4 * x;
+		}		
+		
+		public static void Main(string[] args)
+		{	
+			// Console.WriteLine("pi = " + Math.PI);
+			// Console.WriteLine("a ^ 4 = " + Power5(4.0));			
+			
+			Apples(5);
+			Apples(1);			
+			Apples(0);
+			Console.Write("Press any key to instole the game ");
+			Console.ReadKey(true);
+		}
+	}
+}

console/Properties/AssemblyInfo.cs

+#region Using directives
+
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+#endregion
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("console")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("console")]
+[assembly: AssemblyCopyright("Copyright 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// This sets the default COM visibility of types in the assembly to invisible.
+// If you need to expose a type to COM, use [ComVisible(true)] on that type.
+[assembly: ComVisible(false)]
+
+// The assembly version has following format :
+//
+// Major.Minor.Build.Revision
+//
+// You can specify all the values or you can use the default the Revision and 
+// Build Numbers by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.*")]

console/console.csproj

+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
+  <PropertyGroup>
+    <ProjectGuid>{19968AC1-6A10-4340-A8B7-4C680A3B4FB9}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>console</RootNamespace>
+    <AssemblyName>console</AssemblyName>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Platform)' == 'x86' ">
+    <PlatformTarget>x86</PlatformTarget>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+    <OutputPath>bin\Debug\</OutputPath>
+    <DebugSymbols>True</DebugSymbols>
+    <DebugType>Full</DebugType>
+    <Optimize>False</Optimize>
+    <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+    <OutputPath>bin\Release\</OutputPath>
+    <DebugSymbols>False</DebugSymbols>
+    <DebugType>None</DebugType>
+    <Optimize>True</Optimize>
+    <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
+    <DefineConstants>TRACE</DefineConstants>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Core">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Data" />
+    <Reference Include="System.Data.DataSetExtensions">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="System.Xml" />
+    <Reference Include="System.Xml.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
+</Project>

console/console.sln

+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+# SharpDevelop 4.1.0.8000
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "console", "console.csproj", "{19968AC1-6A10-4340-A8B7-4C680A3B4FB9}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{19968AC1-6A10-4340-A8B7-4C680A3B4FB9}.Debug|x86.Build.0 = Debug|x86
+		{19968AC1-6A10-4340-A8B7-4C680A3B4FB9}.Debug|x86.ActiveCfg = Debug|x86
+		{19968AC1-6A10-4340-A8B7-4C680A3B4FB9}.Release|x86.Build.0 = Release|x86
+		{19968AC1-6A10-4340-A8B7-4C680A3B4FB9}.Release|x86.ActiveCfg = Release|x86
+	EndGlobalSection
+EndGlobal