Aktuelle Notizen zum C#-Kurs [] (Aktuelle Notizen zum C#-Kurs), Notizen, Seite 723548
https://www.purl.org/stefan_ram/pub/aktuelles_csharp (Permalink) ist die kanonische URI dieser Seite.
Stefan Ram
C#-Kurs

Aktuelle Notizen zum C♯ -Kurs

Notizen vom 24. April 2016

Program.cs
public class Example
{
public static void Main( string[] args )
{


{
global::System.Console.WriteLine( 1f.GetType() );
global::System.Console.WriteLine( 1m.GetType() );
global::System.Console.WriteLine( "abc".GetType() );
global::System.Console.WriteLine( 15.0.GetType() );
global::System.Console.WriteLine( 15.GetType() );
}


/*
{
global::System.Console.WriteLine( 15 % 5 == 0 );
}


{
global::System.Console.WriteLine( 0.1m + 0.1m + 0.1m - 0.3m );
}

{
float x =( float )7.0; float y = 2.0F;
global::System.Console.WriteLine( x / y );
}

{ double x = 7.0; double y = 2.0;
global::System.Console.WriteLine( ( int )x / ( int )y );
int i =( int )x; // cast
}
*/

/*
global::System.Console.WriteLine( "abc\"d\\ef" );
global::System.Console.WriteLine( "C:\\Windows\\System" );
global::System.Console.WriteLine( @"C:\Windows\System" );
global::System.Console.WriteLine( @"C:\Wind""ows\System" );
global::System.Console.WriteLine( @"Alpha
Beta
Gamma" );
*/

/*
{ int i = 0; int l = args.GetLength( 0 );
while( i < l )System.Console.WriteLine( args[ i++ ] ); }

{ int l = args.GetLength( 0 );
for( int i = 0; i < l ; ++i )
System.Console.WriteLine( args[ i ] ); }

foreach( var word in args )System.Console.WriteLine( word );
{ int[] a = new int[ 3 ]{ 1, 2, 3 };
foreach( var w in a )System.Console.WriteLine( w ); }

{ var a = new int[]{ 10, 20, 20 };
foreach( var w in a )System.Console.WriteLine( w ); }
*/









/*
{ var a = new int[]{ 10, 20, 20, 20 };
double summe = 0;
foreach( int w in a )summe += w;
foreach( var w in a )
System.Console.WriteLine( ( w / summe * 100 )+ " %" ); }
*/









/* Ausgabe:
20 %
40 %
40 % */
/* Man soll sich vorstellen, dass die Reihung a die Stimme
enthaelt, die verschiedene Parteien bei einer Wahl erhalten
haben.

Die Reihung wird in der folgenden Weise festgelegt:
var a = new int[]{ 10, 20, 20 };

Es koennte folgende Festlegung moeglich sein:
var a = new int[]{ 20, 10, 20, 20 };

Schreiben Sie ein Programm, welches die zu den Stimmzahlen
gehoerende prozentuale Anteile ausgibt! Beispielsweise

20 Prozent
40 Prozent
40 Prozent

Falls es zu viele Schwierigkeiten bereitet, dies variabel
zu halten, darf man auch davon ausgehen, dass es immer genau
3 Parteien. Weiteres Beispiel:

var a = new int[]{ 20, 20, 20 };

33 Prozent
33 Prozent
33 Prozent */



}}







































/*
@set CSC=C:\Program Files\MSBuild\14.0\Bin\csc.exe
@"%CSC%" /checked /nologo /warn:4 /debug /optimize ^
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.JScript.dll ^
/reference:System.IO.Compression.FileSystem.dll ^
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationCore.dll ^
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\PresentationFramework.dll ^
/reference:System.dll ^
/reference:System.Windows.dll ^
/reference:System.Xaml.dll ^
/reference:C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF\WindowsBase.dll ^
/reference:"C:\Program Files\Microsoft Office\Office15\DCF\Microsoft.Office.Interop.Excel.dll" ^
Main.cs
@IF NOT ERRORLEVEL 1 .\Main.exe
@PAUSE
*/


/*
using Xl = Microsoft.Office.Interop.Excel;

class Program1427
{ static void Main1427()
{ var excel = new Xl.Application();
excel.Visible = true;
dynamic workbook = excel.Workbooks.Add();
Xl.Worksheet worksheet = workbook.ActiveSheet;
workbook.SaveAs
( "example.xls",
AccessMode: Xl.XlSaveAsAccessMode.xlShared ); }}
*/





















public class Example1421
{
public static void Main1421()
{ System.ConsoleKeyInfo key;
System.Console.Write("Programm ist gestartet.");
while( true )
{
key = System.Console.ReadKey();
System.Console.WriteLine();
System.Console.WriteLine( "Taste: " + key.Key + "." );
System.Console.WriteLine();
}}}























public class Program1407 : System.Windows.Application
{ private static readonly System.Windows.Controls.TextBox textBox
= new System.Windows.Controls.TextBox();
private static readonly System.Windows.Controls.TextBox textBox1
= new System.Windows.Controls.TextBox();
private static readonly System.Windows.Controls.Button button
= new System.Windows.Controls.Button();
[System.STAThread] public static void Main1407()
{ var window = new System.Windows.Window();
window.Title = "Programmbeispiel";
textBox.FontSize *= 4;
textBox1.FontSize *= 4;
button.FontSize *= 4;
button.Content = "Verdoppeln!";
button.Click += new global::System.Windows.RoutedEventHandler( ButtonClick );
var stackPanel
= new System.Windows.Controls.StackPanel();
stackPanel.Orientation = System.Windows.Controls.Orientation.Vertical;
stackPanel.Children.Add( textBox );
stackPanel.Children.Add( button );
stackPanel.Children.Add( textBox1 );
window.Content = stackPanel;
window.Show();
new System.Windows.Application().Run(); }
static void ButtonClick
( global::System.Object @object, global::System.EventArgs args )
{ textBox1.Text =
global::System.Convert.ToString
( global::System.Convert.ToInt32
( textBox.Text )* 2 ); }}











class Example1327
{ static void Main1327()
{
int jahreseinkommen = 40000;

if( jahreseinkommen < 10000 )
global::System.Console.WriteLine( "1000" );
else
if( jahreseinkommen < 50000 )
global::System.Console.WriteLine( "5000" );
else global::System.Console.WriteLine( "7000" );

global::System.Console.WriteLine
( jahreseinkommen < 10000 ? 1000 :
jahreseinkommen < 50000 ? 5000 : 7000 );

/*
if( true )global::System.Console.WriteLine( "true" );
else global::System.Console.WriteLine( "false" );

if( false )global::System.Console.WriteLine( "true 1" );
else global::System.Console.WriteLine( "false 1" );
*/
global::System.Console.WriteLine( true ? "true 2" : "false 2" );

global::System.Console.WriteLine( false ? "true 3" : "false 3" );

}}


















class Example1307
{ static void Main1307()
{ int i = 11;
global::System.Console.WriteLine( i++ );
global::System.Console.WriteLine( i );
/* while( i++ == 28 == false )
global::System.Console.WriteLine( i ); */
}}

class Example1156
{ static void Main1156()
{ int i = 11;
while( ( i += 1 )== 28 == false )
global::System.Console.WriteLine( i );
}}

class Example1154
{ static void Main1154()
{ global::System.Console.WriteLine( 11 < 12 );
global::System.Console.WriteLine( 11 < 11 );
global::System.Console.WriteLine( 11 < 10 );
global::System.Console.WriteLine( 11 > 12 );
global::System.Console.WriteLine( 11 > 11 );
global::System.Console.WriteLine( 11 > 10 );
global::System.Console.WriteLine( 11 <= 12 );
global::System.Console.WriteLine( 11 <= 11 );
global::System.Console.WriteLine( 11 <= 10 );
global::System.Console.WriteLine( 11 >= 12 );
global::System.Console.WriteLine( 11 >= 11 );
global::System.Console.WriteLine( 11 >= 10 );
}}




























class Example1150
{ static void Main1150()
{ int i = 11;
while( ( i = i + 1 )== 28 == false )
global::System.Console.WriteLine( i );
}}



class Example1145
{ static void Main1145()
{ int v = -1;
while( ( v = v + 1 )== 10 == false )
global::System.Console.WriteLine( "Dieses ist ein langer Satz." );
}}


class Example1125
{ static void Main1125()
{ bool v = false;
while( v == false )
global::System.Console.WriteLine( 25 ); }}

























class Example1118
{ static void Main1118()
{ int i = 32;
while( i == 127 == false )
{ global::System.Console.WriteLine
( "{0} {1} {2} {3} {4}", i, global::System.Char.ConvertFromUtf32( i ),
global::System.Char.IsDigit( global::System.Char.ConvertFromUtf32( i ), 0 )? "D" : " ",
global::System.Char.IsLetter( global::System.Char.ConvertFromUtf32( i ), 0 )? "A" : " ",
global::System.Char.IsWhiteSpace( global::System.Char.ConvertFromUtf32( i ), 0 )? "space" : " " );
i = i + 1; }}}













class Example1048
{

static bool IsNotZero( int a )
{ return a == 0 == false; }

static bool IsGreaterOrEqual( int n, int r )
{ return IsNotZero( n / r ); }

static void stern( int n )
{ if( IsGreaterOrEqual( n, 2 ))stern( n - 1 ); }

static void Main1048()
{ stern( 99999 ); global::System.Console.WriteLine(); }}








class Example1042
{

static bool IsNotZero( int a )
{ return a == 0 == false; }

static bool IsGreaterOrEqual( int n, int r )
{ return IsNotZero( n / r ); }

static void stern( int n )
{ if( IsGreaterOrEqual( n, 1 ))global::System.Console.Write( "*" );
if( IsGreaterOrEqual( n, 2 ))stern( n - 1 ); }

static void Main1042()
{ stern( 79 ); global::System.Console.WriteLine(); }}







class Example1035
{

static void SchreibeKehrwert( int i )
{ if( i == 0 == false )
global::System.Console.WriteLine( 10 / i ); }

static void Main1035()
{ SchreibeKehrwert( 2 );
SchreibeKehrwert( 0 ); }}







class Program1031
{ static void Main1031( string[] args )
{ if( ( ( System.Action )
( ()
=>
System.Console.WriteLine( "hello, world" )))
.DynamicInvoke() == null ){} }}




class Example1016
{

static bool IsNotZero( int a )
{ return a == 0 == false; }

static bool IsGreaterOrEqual( int n, int r )
{ return IsNotZero( n / r ); }

static void stern( int n )
{ if( IsGreaterOrEqual( n, 1 ))global::System.Console.Write( "*" );
if( IsGreaterOrEqual( n, 2 ))global::System.Console.Write( "*" );
if( IsGreaterOrEqual( n, 3 ))global::System.Console.Write( "*" );
if( IsGreaterOrEqual( n, 4 ))global::System.Console.Write( "*" ); }

static void Main1016()
{ stern( 2 ); stern( 1 ); global::System.Console.WriteLine(); }}




















class Example1000
{
#pragma warning disable 162
static void Main1000()
{ if( true )
{ global::System.Console.WriteLine( "Haus" );
global::System.Console.WriteLine( "Hof" ); }
if( false )
{ global::System.Console.WriteLine( "Garten" );
global::System.Console.WriteLine( "123" ); }}}



class Example953
{
#pragma warning disable 162
static void Main953()
{ if( false )global::System.Console.WriteLine( "false" );
}}


















class Example947
{

static bool DruckHallo()
{ global::System.Console.WriteLine( "Hallo" );
return true; }

static void Main947()
{ if( DruckHallo() ){} }}



















public class Program941
{

public static bool ToBool( int wert )
{ return wert == 0 == false; }

public static bool IstDurchVierTeilbar( double wert )
{ return wert/4 == global::System.Math.Floor( wert/4 ); }

public static void Main941()
{

global::System.Console.WriteLine( ToBool( 0 ));
global::System.Console.WriteLine( ToBool( -1 ));
global::System.Console.WriteLine( ToBool( +1 ));
global::System.Console.WriteLine( ToBool( -10 ));
global::System.Console.WriteLine( ToBool( +10 ));

global::System.Console.WriteLine( IstDurchVierTeilbar( 0 ));
global::System.Console.WriteLine( IstDurchVierTeilbar( 1 ));
global::System.Console.WriteLine( IstDurchVierTeilbar( 2 ));
global::System.Console.WriteLine( IstDurchVierTeilbar( 3 ));
global::System.Console.WriteLine( IstDurchVierTeilbar( 4 ));
global::System.Console.WriteLine( IstDurchVierTeilbar( 5 ));
global::System.Console.WriteLine( IstDurchVierTeilbar( 6 ));
global::System.Console.WriteLine( IstDurchVierTeilbar( 7 ));
global::System.Console.WriteLine( IstDurchVierTeilbar( 8 ));
global::System.Console.WriteLine( IstDurchVierTeilbar( 9 ));

}}

































public class ProgramOld
{

/* Lektion 11.2. Die Auswertungswahl in C# */
public static string Wort1( int n ){ return n == 0 ? "Null" : n == 1 ? "Eins" : "Zwei"; }
public static string Wort( int n ){ return n == 0 ? "Null" : "Eins"; }

/* Lektion 11.2. Die Auswertungswahl in C# */
public static int N( int n ){ return n == 0 ? 0 : 10/n; }
public static int M( int n ){ return n != 0 ? 10/n : 0; }
public static int K( int n ){ return 1/n; }

/* Lektion 11.2. Die Auswertungswahl in C# */
public static void Main3()
{ global::System.Console.WriteLine( K( 2 )); /*
global::System.Console.WriteLine( K( 0 )); */
global::System.Console.WriteLine( M( 2 ));
global::System.Console.WriteLine( M( 0 ));
global::System.Console.WriteLine( N( 2 ));
global::System.Console.WriteLine( N( 0 ));
global::System.Console.WriteLine( Wort( 0 ));
global::System.Console.WriteLine( Wort( 1 ));
global::System.Console.WriteLine( Wort( 2 ));
global::System.Console.WriteLine( Wort1( 0 ));
global::System.Console.WriteLine( Wort1( 1 ));
global::System.Console.WriteLine( Wort1( 2 )); }

/* Lektion 11.1. Gleichheitsaussagen in C# */
public static void Main2()
{ global::System.Console.WriteLine( 1 == 2 );
global::System.Console.WriteLine( 2 == 2 );
global::System.Console.WriteLine( true == false );
global::System.Console.WriteLine( 0.1 + 0.1 + 0.1 == 0.3 );
global::System.Console.WriteLine( 0.1m + 0.1m + 0.1m == 0.3m );
global::System.Console.WriteLine( "abc" == "ab" + "c" ); }

/* Lektion 11.0. Der Datentyp "bool" in C# */
public static bool T() { return true; }

/* Lektion 11.0. Der Datentyp "bool" in C# */
public static void P( bool b )
{ global::System.Console.WriteLine( b ); }

/* Lektion 11.0. Der Datentyp "bool" in C# */
public static void Main1()
{ global::System.Console.WriteLine( true );
global::System.Console.WriteLine( false );
global::System.Console.WriteLine( global::System.Char.IsDigit( 'A' ) );
global::System.Console.WriteLine( T() );
P( true );
P( false ); }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void SchreibZahl( int i )
{ global::System.Console.WriteLine( i ); }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static double S( int i )
{ return 1 + i; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static double Kehrwert( double x )
{ return 1 / x; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static double Summe( double a, double b )
{ return a + b; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void Swap( ref int a, ref int b )
{ int alterWertVonA = a; a = b; b = alterWertVonA; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static int W( int n )
{ return 17 - 5 * n; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void Muster( int n )
{ global::System.Console.WriteLine( "{0}", n );
global::System.Console.WriteLine( "{0} 32251", n );
global::System.Console.WriteLine( "{0}", n ); }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void Zeilen()
{ Muster( 11910 );
Muster( 23141 );
Muster( 10312 );
Muster( 24170 );
Muster( 17233 );
Muster( 24947 ); }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void Main0()
{ SchreibZahl( 15 );
global::System.Console.WriteLine( S( 2 ));
global::System.Console.WriteLine( Kehrwert( 2 ));
global::System.Console.WriteLine( Summe( 2.2, 1.1 ));
int x = 10; int y = 12;
Swap( ref x, ref y );
global::System.Console.WriteLine( x );
global::System.Console.WriteLine( y );
global::System.Console.WriteLine( W( 0 ));
global::System.Console.WriteLine( W( 1 ));
Zeilen(); }

/* Lektion 9.0. Deklaration von Wertmethoden in C# */
public static double Acht(){ return 8.0; }

/* Lektion 9.0. Deklaration von Wertmethoden in C# */
public static double Z()
{ return global::Microsoft.JScript.MathObject.random(); }

/* Lektion 9.0. Deklaration von Wertmethoden in C# */
public static double Wuerfel()
{ return global::System.Math.Floor( 1 + 6 * Z() ); }

/* Lektion 9.0. Deklaration von Wertmethoden in C# */
public static void MainA()
{ global::System.Console.WriteLine( Acht() );
global::System.Console.WriteLine( Z() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void Alpha()
{ global::System.Console.WriteLine( "Alpha" ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void ZweiAusgeben()
{ global::System.Console.WriteLine( 2 ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void Wuerfeln()
{ global::System.Console.WriteLine
( global::System.Math.Floor
( 1 + 6 * global::Microsoft.JScript.MathObject.random() ) ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void Trg()
{ global::System.Console.WriteLine( "Tomaten" );
global::System.Console.WriteLine( "Rothol Gruenkohl" ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void Gemuese()
{ Trg(); global::System.Console.WriteLine( "Lauch" );
Trg(); global::System.Console.WriteLine( "Kohlrabi" );
Trg(); global::System.Console.WriteLine( "Spinat" ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void MainB()
{ Alpha();
ZweiAusgeben();
Wuerfeln();
Gemuese(); }

public static void MainOld()
{ MainB();
MainA();
Main0();
Main1();
Main2();
Main3(); }}


public static class Example941
{

public static void SchreibZahl( int zahl )
{ System.Console.Write( zahl ); }

public static int s( int zahl ){ return zahl + 1; }

public static double Kehrwert( double zahl ){ return 1/zahl; }

public static double Summe
( double zahl, double zahl1 )
{ return zahl + zahl1; }

public static void Tausche
( ref int zahl, ref int zahl1 )
{ int alter_wert_von_zahl = zahl;
zahl = zahl1; zahl1 = alter_wert_von_zahl; }

public static int W( int zahl ){ return 17 - 5 * zahl; }

public static void Muster( int zahl )
{ System.Console.WriteLine( "{0}\n{0} 32251\n{0}", zahl ); }

public static void Zeilen()
{ Muster( 11910 ); Muster( 23141 ); Muster( 10312 );
Muster( 24170 ); Muster( 17233 ); Muster( 24947 ); }

static double Wuerfel( int max )
{ return
( global::System.Math.Floor
( 1 + max * global::Microsoft.JScript.MathObject.random() )); }

static void MainOld( string[] args )
{ SchreibZahl( 44 );
System.Console.WriteLine();
System.Console.WriteLine( s( 2 ));
System.Console.WriteLine( Kehrwert( 4 ));
System.Console.WriteLine( Summe( 4, 2 ));
int a = 5; int b = 7;

Tausche( ref a, ref b );

System.Console.WriteLine( a );
System.Console.WriteLine( b );

System.Console.WriteLine( W( 0 ));
System.Console.WriteLine( W( 1 ));

Zeilen();

System.Console.WriteLine( Wuerfel( 10 ));




}

























public static void PaarAusgeben( ref int zahl, int zahl1 )
{ zahl = 5;
System.Console.Write( zahl );
System.Console.Write( ", " );
System.Console.WriteLine( zahl1 ); }

static void Main3( string[] args )
{ int x = 7; int y = 14;
System.Console.WriteLine( x );
System.Console.WriteLine( y ); }



















static double Acht() { return 8.0; }

static double Z()
{ return global::Microsoft.JScript.MathObject.random(); }

static double Wuerfel()
{ return
( global::System.Math.Floor
( 1 + 6 * global::Microsoft.JScript.MathObject.random() )); }

static void Main2()
{ global::System.Console.WriteLine( Acht() );
global::System.Console.WriteLine( Z() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
}

























static void Wuerfel1()
{ global::System.Console.WriteLine
( global::System.Math.Floor
( 1 + 6 * global::Microsoft.JScript.MathObject.random() )); }

static void trg()
{ global::System.Console.WriteLine( "Tomaten\nRotkohl Gruenkohl" ); }

static void Main1()
{ trg(); global::System.Console.WriteLine( "Lauch" );
trg(); global::System.Console.WriteLine( "Kohlrabi" );
trg(); global::System.Console.WriteLine( "Spinat" ); }}

Notizen vom 23. April 2016

Program.cs
public class Program
{

/* Lektion 11.2. Die Auswertungswahl in C# */
public static string Wort1( int n ){ return n == 0 ? "Null" : n == 1 ? "Eins" : "Zwei"; }
public static string Wort( int n ){ return n == 0 ? "Null" : "Eins"; }

/* Lektion 11.2. Die Auswertungswahl in C# */
public static int N( int n ){ return n == 0 ? 0 : 10/n; }
public static int M( int n ){ return n != 0 ? 10/n : 0; }
public static int K( int n ){ return 1/n; }

/* Lektion 11.2. Die Auswertungswahl in C# */
public static void Main3()
{ global::System.Console.WriteLine( K( 2 )); /*
global::System.Console.WriteLine( K( 0 )); */
global::System.Console.WriteLine( M( 2 ));
global::System.Console.WriteLine( M( 0 ));
global::System.Console.WriteLine( N( 2 ));
global::System.Console.WriteLine( N( 0 ));
global::System.Console.WriteLine( Wort( 0 ));
global::System.Console.WriteLine( Wort( 1 ));
global::System.Console.WriteLine( Wort( 2 ));
global::System.Console.WriteLine( Wort1( 0 ));
global::System.Console.WriteLine( Wort1( 1 ));
global::System.Console.WriteLine( Wort1( 2 )); }

/* Lektion 11.1. Gleichheitsaussagen in C# */
public static void Main2()
{ global::System.Console.WriteLine( 1 == 2 );
global::System.Console.WriteLine( 2 == 2 );
global::System.Console.WriteLine( true == false );
global::System.Console.WriteLine( 0.1 + 0.1 + 0.1 == 0.3 );
global::System.Console.WriteLine( 0.1m + 0.1m + 0.1m == 0.3m );
global::System.Console.WriteLine( "abc" == "ab" + "c" ); }

/* Lektion 11.0. Der Datentyp "bool" in C# */
public static bool T() { return true; }

/* Lektion 11.0. Der Datentyp "bool" in C# */
public static void P( bool b )
{ global::System.Console.WriteLine( b ); }

/* Lektion 11.0. Der Datentyp "bool" in C# */
public static void Main1()
{ global::System.Console.WriteLine( true );
global::System.Console.WriteLine( false );
global::System.Console.WriteLine( global::System.Char.IsDigit( 'A' ) );
global::System.Console.WriteLine( T() );
P( true );
P( false ); }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void SchreibZahl( int i )
{ global::System.Console.WriteLine( i ); }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static double S( int i )
{ return 1 + i; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static double Kehrwert( double x )
{ return 1 / x; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static double Summe( double a, double b )
{ return a + b; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void Swap( ref int a, ref int b )
{ int alterWertVonA = a; a = b; b = alterWertVonA; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static int W( int n )
{ return 17 - 5 * n; }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void Muster( int n )
{ global::System.Console.WriteLine( "{0}", n );
global::System.Console.WriteLine( "{0} 32251", n );
global::System.Console.WriteLine( "{0}", n ); }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void Zeilen()
{ Muster( 11910 );
Muster( 23141 );
Muster( 10312 );
Muster( 24170 );
Muster( 17233 );
Muster( 24947 ); }

/* Lektion 10.0. Deklaration von Parametern in C# */
public static void Main0()
{ SchreibZahl( 15 );
global::System.Console.WriteLine( S( 2 ));
global::System.Console.WriteLine( Kehrwert( 2 ));
global::System.Console.WriteLine( Summe( 2.2, 1.1 ));
int x = 10; int y = 12;
Swap( ref x, ref y );
global::System.Console.WriteLine( x );
global::System.Console.WriteLine( y );
global::System.Console.WriteLine( W( 0 ));
global::System.Console.WriteLine( W( 1 ));
Zeilen(); }

/* Lektion 9.0. Deklaration von Wertmethoden in C# */
public static double Acht(){ return 8.0; }

/* Lektion 9.0. Deklaration von Wertmethoden in C# */
public static double Z()
{ return global::Microsoft.JScript.MathObject.random(); }

/* Lektion 9.0. Deklaration von Wertmethoden in C# */
public static double Wuerfel()
{ return global::System.Math.Floor( 1 + 6 * Z() ); }

/* Lektion 9.0. Deklaration von Wertmethoden in C# */
public static void MainA()
{ global::System.Console.WriteLine( Acht() );
global::System.Console.WriteLine( Z() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() );
global::System.Console.WriteLine( Wuerfel() ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void Alpha()
{ global::System.Console.WriteLine( "Alpha" ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void ZweiAusgeben()
{ global::System.Console.WriteLine( 2 ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void Wuerfeln()
{ global::System.Console.WriteLine
( global::System.Math.Floor
( 1 + 6 * global::Microsoft.JScript.MathObject.random() ) ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void Trg()
{ global::System.Console.WriteLine( "Tomaten" );
global::System.Console.WriteLine( "Rothol Gruenkohl" ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void Gemuese()
{ Trg(); global::System.Console.WriteLine( "Lauch" );
Trg(); global::System.Console.WriteLine( "Kohlrabi" );
Trg(); global::System.Console.WriteLine( "Spinat" ); }

/* Lektion 8.0. Deklaration statischer Wirkmethoden in C# */
public static void MainB()
{ Alpha();
ZweiAusgeben();
Wuerfeln();
Gemuese(); }

public static void Main()
{ MainB();
MainA();
Main0();
Main1();
Main2();
Main3(); }}

Seiteninformationen und Impressum   |   Mitteilungsformular  |   "ram@zedat.fu-berlin.de" (ohne die Anführungszeichen) ist die Netzpostadresse von Stefan Ram.   |   Eine Verbindung zur Stefan-Ram-Startseite befindet sich oben auf dieser Seite hinter dem Text "Stefan Ram".)  |   Der Urheber dieses Textes ist Stefan Ram. Alle Rechte sind vorbehalten. Diese Seite ist eine Veröffentlichung von Stefan Ram. Schlüsselwörter zu dieser Seite/relevant keywords describing this page: Stefan Ram Berlin slrprd slrprd stefanramberlin spellched stefanram723548 stefan_ram:723548 Aktuelle Notizen zum C#-Kurs Stefan Ram, Berlin, and, or, near, uni, online, slrprd, slrprdqxx, slrprddoc, slrprd723548, slrprddef723548, PbclevtugFgrsnaEnz Erklärung, Beschreibung, Info, Information, Hinweis,

Der Urheber dieses Textes ist Stefan Ram. Alle Rechte sind vorbehalten. Diese Seite ist eine Veröffentlichung von Stefan Ram.
https://www.purl.org/stefan_ram/pub/aktuelles_csharp