SlideShare a Scribd company logo
1 of 41
Tech Talk – C# und das Microsoft .NET Framework Heinrich Wendel, DLR Simulations- und Softwaretechnik 30. Juli 2008
Entstehungsgeschichte ,[object Object],[object Object],[object Object]
History ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Architektur
Common Language Infrastructure ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Interoperabilität
Assemblies ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Dynamic Assembly loading ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# - Namespaces // Defining namespaces namespace  Dlr.Sistec { class Test { … } } // Nested namespaces namespace  Dlr { namespace  Sistec { class Test {…} } } // Using namespaces Dlr.Sistec.Test  = new Dlr.Sistec.Test(); // Short form Using Dlr.Sistec; Test = new  Test(); // Aliases Using ns = Dlr.Sistec; ns.Test = new  ns.Test();
C# - Control Flow ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# - Iterators Months months = new Months();  foreach (string temp in months)    Console.WriteLine(temp);  public class Months :  IEnumerable  {     string[] month = { &quot;Januar&quot;, &quot;Februar&quot;, &quot;März&quot;, &quot;April&quot;, &quot;Mai&quot;, &quot;Juni&quot;, &quot;Juli&quot;, &quot;August&quot;, &quot;September&quot;, &quot;Oktober&quot;, &quot;November&quot;, &quot;Dezember&quot;};   public IEnumerator GetEnumerator() {      for (int i = 0; i < month.Length; i++)         yield  return month[i];    }  }
C# - Switch / Enums string s = Console.ReadLine();; switch(s) { case „ January “:  … break; case „ Februar “:  … break; case „ March “:  … break; … }
C# - Switch / Enums ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Month m = …; switch (m) { case  Month.January :  break; case  Month.February :  break; case  3 :  break; … }
C# - Switch / Enums [Flags]  public enum Keys {  Shift = 1,  Ctrl = 2,  Alt = 4  } Keys k = Keys.Shift | Keys.Ctrl if ((k & Keys.Shift) == Keys.Shift) {…}
C# - Indexer String[] People = { „Schreiber, „Legenhausen“, „Wendel“}; Console.Write( People[0] ) People[1]  = Console.ReadLine() ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# - Properties public class Person { private string  firstName ; private string  lastName ; public void  setFirstName (string name) this.firstName = name; }  public string  getLastName () return this.lastName; } public void  setLastName (string name) this.lastName = name }  public string  getFirstName () return this.firstName; } }   public class Person {    public string  FirstName  { get  { return firstName; } set  { firstName =  value ; } } private string  firstName ;   public string  LastName  { get  { return lastName; } set  { lastName =  value ; } } private string  lastName ; }   Public class Person {    public string  FirstName  {  get; set ; } public string  LastName  {  get; set ; } }
C# - Attributes ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# - Attributes [AttributeUsage(AttributeTargets.All)]  public class DeveloperAttribute :  Attribute  {  public string Zuname;  public int PersID; public DeveloperAttribute(string name) {  Zuname = name;  }  } [DeveloperAttribute(&quot;Meier&quot;, PersID = 8815)]  class Program {  static void Main(string[] args) {  DeveloperAttribute  attr  =  (DeveloperAttribute)Attribute.  GetCustomAttribute(typeof(Program),  typeof(DeveloperAttribute));  Console.WriteLine(&quot;Name: {0}&quot;,  attr.Zuname );  Console.WriteLine(&quot;PersID: {0}&quot;,  attr.PersID );  }
C# - Delegates / Events public class Logger { public  delegate  void Log(string message); private  static  Log  log ger ; public  static void Main(string[] args) { log ger  = new Log(PrintToConsole); log ger.Invoke (&quot;message&quot;); } public static void  PrintToConsole(string  message) { Console.WriteLine(message); } } public class Logger { public  delegate  void Log(string message); private  static  Log  logList; public  static void Main(string[] args) { logList  +=  new Log(PrintToConsole); logList  +=  new Log(PrintTo File ); logList (&quot;message&quot;); } public static void  PrintToConsole (string message) {  … }  public static void  PrintTo File (string message) {  … } } public class Logger { public  delegate  void Log(string message); public  static  event   Log  logList ; public  static void Main(string[] args) { logList  +=  PrintToConsole; logList  +=  PrintTo File ; logList (&quot;message&quot;); } public static void  PrintToConsole (string message) {  … }  public static void  PrintTo File (string message) {  … } }
C# - Lambda Funktionen public class Logger {  public delegate void Log(string message); private static Log logList; public  static void Main(string[] args) { logList =  delegate(string message)  { Console.WriteLine(message); }; logList(&quot;message&quot;); } } public class Logger {  public delegate void Log(string message); private static Log logList; public  static void Main(string[] args) { logList =  message  =>  { Console.WriteLine(message); }; logList(&quot;message&quot;); } } List <int> evenNumbers = list.FindAll(  i => (i%2) == 0  );
[object Object],[object Object],C# - LINQ int[] numbers = { 10, 20, 30, 40, 1, 2, 3, 8 }; var  subset =  from i in numbers where i < 10 select i ; foreach (int i in subset) Console.WriteLine(i);
C# - Structs ,[object Object],[object Object],[object Object],public  struct  Point {    int x {get; set} int y {get; set} public Point(int x, int y) { … } public int getDistance(int x, int y) { … } public static Point operator +(Point p) {…} }
C# - Constructors public class Point { public Point(int x, int y) { X = x; Y = y; } public Point() { } public int X { get; set; } public int Y { get; set; } } Point p = new Point(1, 2) Point p = new Point() P.X = 1; p.Y = 2; Point p = new Point { X = 1, Y = 2 }
C# - Constructors public class Point { public int X { get; set; } public int Y { get; set; } } public class Rectangle { public Point topLeft { get; set; } public Point bottomRight { get; set; } } Rectangle r = new Rectangle {  topLeft = new Point{ X = 0, Y = 0 }, bottomRight = new Point { X = 2, Y = 2 }  } Rectangle r = new Rectangle(); Point p1 = new Point(); p1.X = 0; p1.Y = 0; Point p2 = new Point(); p2.X = 2; p2.Y = 2; r.topLeft = p1; r.bottomRight = p2;
C# - Unsafe Code ,[object Object],[object Object],[object Object],[object Object],int var1 = 5;  unsafe   {  int  *  ptr1, ptr2;  ptr1 =  & var1;  ptr2 = ptr1;  *ptr2 = 20;  }  Console.WriteLine(var1);
C# - Preprocessor ,[object Object],[object Object],[object Object]
C# - Exception Handling ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# - Method Calls void FunctionA( ref  int Val) { int x= Val;  Val = x* 4;  } int a= 5; FunctionA( ref  a); Console.WriteLine(a);  bool GetNodeValue( out  int Val)  { Val = 1; return true;  }  int Val; GetNodeValue(Val); Console.WriteLine(a);  void Func(params  int[]  array) { Console.WriteLine(array.Length); } Func(1); Func(7,9); Func(new int[] {3,8,10});
C# - Extension Methods public  static  class  ExtensionClass  { public  static  int MultiplyByTwo( this int number) { return number * 2; } } public class Class1 { public static void Main(string[] args) { int number = 2; Console.WriteLine( number.MultiplyByTwo() ); } }
C# - Casting object [] myObjects = new object[1] myObjects[0] = new MyClass1(); string s; // Exception s = (string) myObjects[0] public static explicit operator String(MyClass1) { return “SomeString”; } If (myObjects[0]  is  string) { s = (string) myObjects[1] } s = myObjects[0] as string
C# - Keywordmania ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
C# - Was sonst noch geht … ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Library ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Parallel Programming ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Entwicklungsumgebungen ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Tools ,[object Object],[object Object],[object Object],[object Object],[object Object]
Lizenzen ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Alternative .NET Implementierungen ,[object Object],[object Object],[object Object],[object Object],[object Object]
IKVM.NET ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
IronPython ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 

More Related Content

What's hot

OOP and FP - Become a Better Programmer
OOP and FP - Become a Better ProgrammerOOP and FP - Become a Better Programmer
OOP and FP - Become a Better ProgrammerMario Fusco
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modelingMario Fusco
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesGanesh Samarthyam
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongMario Fusco
 
Fun with Lambdas: C++14 Style (part 1)
Fun with Lambdas: C++14 Style (part 1)Fun with Lambdas: C++14 Style (part 1)
Fun with Lambdas: C++14 Style (part 1)Sumant Tambe
 
C++11 concurrency
C++11 concurrencyC++11 concurrency
C++11 concurrencyxu liwei
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meetMario Fusco
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarROHIT JAISWAR
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!José Paumard
 
Kotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime PerformanceKotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime Performanceintelliyole
 
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...Chris Richardson
 
Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Geeks Anonymes
 
Qt Memory Management & Signal and Slots
Qt Memory Management & Signal and SlotsQt Memory Management & Signal and Slots
Qt Memory Management & Signal and SlotsJussi Pohjolainen
 

What's hot (20)

OOP and FP - Become a Better Programmer
OOP and FP - Become a Better ProgrammerOOP and FP - Become a Better Programmer
OOP and FP - Become a Better Programmer
 
C++11
C++11C++11
C++11
 
From object oriented to functional domain modeling
From object oriented to functional domain modelingFrom object oriented to functional domain modeling
From object oriented to functional domain modeling
 
Design Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on ExamplesDesign Patterns - Compiler Case Study - Hands-on Examples
Design Patterns - Compiler Case Study - Hands-on Examples
 
Java 8 Workshop
Java 8 WorkshopJava 8 Workshop
Java 8 Workshop
 
If You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are WrongIf You Think You Can Stay Away from Functional Programming, You Are Wrong
If You Think You Can Stay Away from Functional Programming, You Are Wrong
 
C++11 & C++14
C++11 & C++14C++11 & C++14
C++11 & C++14
 
C# 7
C# 7C# 7
C# 7
 
Fun with Lambdas: C++14 Style (part 1)
Fun with Lambdas: C++14 Style (part 1)Fun with Lambdas: C++14 Style (part 1)
Fun with Lambdas: C++14 Style (part 1)
 
C++11 concurrency
C++11 concurrencyC++11 concurrency
C++11 concurrency
 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
 
Generics
GenericsGenerics
Generics
 
What's New In C# 7
What's New In C# 7What's New In C# 7
What's New In C# 7
 
Java Keeps Throttling Up!
Java Keeps Throttling Up!Java Keeps Throttling Up!
Java Keeps Throttling Up!
 
Kotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime PerformanceKotlin Bytecode Generation and Runtime Performance
Kotlin Bytecode Generation and Runtime Performance
 
What's New in C++ 11?
What's New in C++ 11?What's New in C++ 11?
What's New in C++ 11?
 
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...Map(), flatmap() and reduce() are your new best friends: simpler collections,...
Map(), flatmap() and reduce() are your new best friends: simpler collections,...
 
Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)
 
Qt Memory Management & Signal and Slots
Qt Memory Management & Signal and SlotsQt Memory Management & Signal and Slots
Qt Memory Management & Signal and Slots
 

Similar to TechTalk - Dotnet

Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET componentsBình Trọng Án
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003R696
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4Abed Bukhari
 
Applying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing SpeedApplying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing SpeedPascal-Louis Perez
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Juan Pablo
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)Chhom Karath
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaJevgeni Kabanov
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsBartosz Kosarzycki
 
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016STX Next
 
20.1 Java working with abstraction
20.1 Java working with abstraction20.1 Java working with abstraction
20.1 Java working with abstractionIntro C# Book
 
C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8Christian Nagel
 
Functional Programming You Already Know
Functional Programming You Already KnowFunctional Programming You Already Know
Functional Programming You Already KnowKevlin Henney
 

Similar to TechTalk - Dotnet (20)

Attributes & .NET components
Attributes & .NET componentsAttributes & .NET components
Attributes & .NET components
 
Linq intro
Linq introLinq intro
Linq intro
 
Clean code _v2003
 Clean code _v2003 Clean code _v2003
Clean code _v2003
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
Applying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing SpeedApplying Compiler Techniques to Iterate At Blazing Speed
Applying Compiler Techniques to Iterate At Blazing Speed
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
PostThis
PostThisPostThis
PostThis
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projects
 
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
 
20.1 Java working with abstraction
20.1 Java working with abstraction20.1 Java working with abstraction
20.1 Java working with abstraction
 
C# 7.0, 7.1, 7.2
C# 7.0, 7.1, 7.2C# 7.0, 7.1, 7.2
C# 7.0, 7.1, 7.2
 
C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8C# 7.x What's new and what's coming with C# 8
C# 7.x What's new and what's coming with C# 8
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
Anti patterns
Anti patternsAnti patterns
Anti patterns
 
Ppt of c vs c#
Ppt of c vs c#Ppt of c vs c#
Ppt of c vs c#
 
Functional Programming You Already Know
Functional Programming You Already KnowFunctional Programming You Already Know
Functional Programming You Already Know
 
srgoc
srgocsrgoc
srgoc
 

Recently uploaded

Guide Complete Set of Residential Architectural Drawings PDF
Guide Complete Set of Residential Architectural Drawings PDFGuide Complete Set of Residential Architectural Drawings PDF
Guide Complete Set of Residential Architectural Drawings PDFChandresh Chudasama
 
trending-flavors-and-ingredients-in-salty-snacks-us-2024_Redacted-V2.pdf
trending-flavors-and-ingredients-in-salty-snacks-us-2024_Redacted-V2.pdftrending-flavors-and-ingredients-in-salty-snacks-us-2024_Redacted-V2.pdf
trending-flavors-and-ingredients-in-salty-snacks-us-2024_Redacted-V2.pdfMintel Group
 
Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Americas Got Grants
 
1911 Gold Corporate Presentation Apr 2024.pdf
1911 Gold Corporate Presentation Apr 2024.pdf1911 Gold Corporate Presentation Apr 2024.pdf
1911 Gold Corporate Presentation Apr 2024.pdfShaun Heinrichs
 
BAILMENT & PLEDGE business law notes.pptx
BAILMENT & PLEDGE business law notes.pptxBAILMENT & PLEDGE business law notes.pptx
BAILMENT & PLEDGE business law notes.pptxran17april2001
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03DallasHaselhorst
 
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...Operational Excellence Consulting
 
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...Hector Del Castillo, CPM, CPMM
 
Excvation Safety for safety officers reference
Excvation Safety for safety officers referenceExcvation Safety for safety officers reference
Excvation Safety for safety officers referencessuser2c065e
 
Supercharge Your eCommerce Stores-acowebs
Supercharge Your eCommerce Stores-acowebsSupercharge Your eCommerce Stores-acowebs
Supercharge Your eCommerce Stores-acowebsGOKUL JS
 
business environment micro environment macro environment.pptx
business environment micro environment macro environment.pptxbusiness environment micro environment macro environment.pptx
business environment micro environment macro environment.pptxShruti Mittal
 
Driving Business Impact for PMs with Jon Harmer
Driving Business Impact for PMs with Jon HarmerDriving Business Impact for PMs with Jon Harmer
Driving Business Impact for PMs with Jon HarmerAggregage
 
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptxGo for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptxRakhi Bazaar
 
Onemonitar Android Spy App Features: Explore Advanced Monitoring Capabilities
Onemonitar Android Spy App Features: Explore Advanced Monitoring CapabilitiesOnemonitar Android Spy App Features: Explore Advanced Monitoring Capabilities
Onemonitar Android Spy App Features: Explore Advanced Monitoring CapabilitiesOne Monitar
 
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptxThe-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptxmbikashkanyari
 
Send Files | Sendbig.comSend Files | Sendbig.com
Send Files | Sendbig.comSend Files | Sendbig.comSend Files | Sendbig.comSend Files | Sendbig.com
Send Files | Sendbig.comSend Files | Sendbig.comSendBig4
 
WSMM Media and Entertainment Feb_March_Final.pdf
WSMM Media and Entertainment Feb_March_Final.pdfWSMM Media and Entertainment Feb_March_Final.pdf
WSMM Media and Entertainment Feb_March_Final.pdfJamesConcepcion7
 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environmentelijahj01012
 
WSMM Technology February.March Newsletter_vF.pdf
WSMM Technology February.March Newsletter_vF.pdfWSMM Technology February.March Newsletter_vF.pdf
WSMM Technology February.March Newsletter_vF.pdfJamesConcepcion7
 

Recently uploaded (20)

Guide Complete Set of Residential Architectural Drawings PDF
Guide Complete Set of Residential Architectural Drawings PDFGuide Complete Set of Residential Architectural Drawings PDF
Guide Complete Set of Residential Architectural Drawings PDF
 
trending-flavors-and-ingredients-in-salty-snacks-us-2024_Redacted-V2.pdf
trending-flavors-and-ingredients-in-salty-snacks-us-2024_Redacted-V2.pdftrending-flavors-and-ingredients-in-salty-snacks-us-2024_Redacted-V2.pdf
trending-flavors-and-ingredients-in-salty-snacks-us-2024_Redacted-V2.pdf
 
Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...
 
1911 Gold Corporate Presentation Apr 2024.pdf
1911 Gold Corporate Presentation Apr 2024.pdf1911 Gold Corporate Presentation Apr 2024.pdf
1911 Gold Corporate Presentation Apr 2024.pdf
 
BAILMENT & PLEDGE business law notes.pptx
BAILMENT & PLEDGE business law notes.pptxBAILMENT & PLEDGE business law notes.pptx
BAILMENT & PLEDGE business law notes.pptx
 
Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03Cybersecurity Awareness Training Presentation v2024.03
Cybersecurity Awareness Training Presentation v2024.03
 
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
The McKinsey 7S Framework: A Holistic Approach to Harmonizing All Parts of th...
 
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
How Generative AI Is Transforming Your Business | Byond Growth Insights | Apr...
 
Excvation Safety for safety officers reference
Excvation Safety for safety officers referenceExcvation Safety for safety officers reference
Excvation Safety for safety officers reference
 
Supercharge Your eCommerce Stores-acowebs
Supercharge Your eCommerce Stores-acowebsSupercharge Your eCommerce Stores-acowebs
Supercharge Your eCommerce Stores-acowebs
 
business environment micro environment macro environment.pptx
business environment micro environment macro environment.pptxbusiness environment micro environment macro environment.pptx
business environment micro environment macro environment.pptx
 
Driving Business Impact for PMs with Jon Harmer
Driving Business Impact for PMs with Jon HarmerDriving Business Impact for PMs with Jon Harmer
Driving Business Impact for PMs with Jon Harmer
 
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptxGo for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
Go for Rakhi Bazaar and Pick the Latest Bhaiya Bhabhi Rakhi.pptx
 
Onemonitar Android Spy App Features: Explore Advanced Monitoring Capabilities
Onemonitar Android Spy App Features: Explore Advanced Monitoring CapabilitiesOnemonitar Android Spy App Features: Explore Advanced Monitoring Capabilities
Onemonitar Android Spy App Features: Explore Advanced Monitoring Capabilities
 
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptxThe-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
The-Ethical-issues-ghhhhhhhhjof-Byjus.pptx
 
The Bizz Quiz-E-Summit-E-Cell-IITPatna.pptx
The Bizz Quiz-E-Summit-E-Cell-IITPatna.pptxThe Bizz Quiz-E-Summit-E-Cell-IITPatna.pptx
The Bizz Quiz-E-Summit-E-Cell-IITPatna.pptx
 
Send Files | Sendbig.comSend Files | Sendbig.com
Send Files | Sendbig.comSend Files | Sendbig.comSend Files | Sendbig.comSend Files | Sendbig.com
Send Files | Sendbig.comSend Files | Sendbig.com
 
WSMM Media and Entertainment Feb_March_Final.pdf
WSMM Media and Entertainment Feb_March_Final.pdfWSMM Media and Entertainment Feb_March_Final.pdf
WSMM Media and Entertainment Feb_March_Final.pdf
 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environment
 
WSMM Technology February.March Newsletter_vF.pdf
WSMM Technology February.March Newsletter_vF.pdfWSMM Technology February.March Newsletter_vF.pdf
WSMM Technology February.March Newsletter_vF.pdf
 

TechTalk - Dotnet

  • 1. Tech Talk – C# und das Microsoft .NET Framework Heinrich Wendel, DLR Simulations- und Softwaretechnik 30. Juli 2008
  • 2.
  • 3.
  • 5.
  • 7.
  • 8.
  • 9. C# - Namespaces // Defining namespaces namespace Dlr.Sistec { class Test { … } } // Nested namespaces namespace Dlr { namespace Sistec { class Test {…} } } // Using namespaces Dlr.Sistec.Test = new Dlr.Sistec.Test(); // Short form Using Dlr.Sistec; Test = new Test(); // Aliases Using ns = Dlr.Sistec; ns.Test = new ns.Test();
  • 10.
  • 11. C# - Iterators Months months = new Months(); foreach (string temp in months) Console.WriteLine(temp); public class Months : IEnumerable {   string[] month = { &quot;Januar&quot;, &quot;Februar&quot;, &quot;März&quot;, &quot;April&quot;, &quot;Mai&quot;, &quot;Juni&quot;, &quot;Juli&quot;, &quot;August&quot;, &quot;September&quot;, &quot;Oktober&quot;, &quot;November&quot;, &quot;Dezember&quot;};   public IEnumerator GetEnumerator() {     for (int i = 0; i < month.Length; i++)       yield return month[i];   } }
  • 12. C# - Switch / Enums string s = Console.ReadLine();; switch(s) { case „ January “: … break; case „ Februar “: … break; case „ March “: … break; … }
  • 13.
  • 14. C# - Switch / Enums [Flags] public enum Keys { Shift = 1, Ctrl = 2, Alt = 4 } Keys k = Keys.Shift | Keys.Ctrl if ((k & Keys.Shift) == Keys.Shift) {…}
  • 15.
  • 16. C# - Properties public class Person { private string firstName ; private string lastName ; public void setFirstName (string name) this.firstName = name; } public string getLastName () return this.lastName; } public void setLastName (string name) this.lastName = name } public string getFirstName () return this.firstName; } } public class Person { public string FirstName { get { return firstName; } set { firstName = value ; } } private string firstName ; public string LastName { get { return lastName; } set { lastName = value ; } } private string lastName ; } Public class Person { public string FirstName { get; set ; } public string LastName { get; set ; } }
  • 17.
  • 18. C# - Attributes [AttributeUsage(AttributeTargets.All)] public class DeveloperAttribute : Attribute { public string Zuname; public int PersID; public DeveloperAttribute(string name) { Zuname = name; } } [DeveloperAttribute(&quot;Meier&quot;, PersID = 8815)] class Program { static void Main(string[] args) { DeveloperAttribute attr = (DeveloperAttribute)Attribute. GetCustomAttribute(typeof(Program), typeof(DeveloperAttribute)); Console.WriteLine(&quot;Name: {0}&quot;, attr.Zuname ); Console.WriteLine(&quot;PersID: {0}&quot;, attr.PersID ); }
  • 19. C# - Delegates / Events public class Logger { public delegate void Log(string message); private static Log log ger ; public static void Main(string[] args) { log ger = new Log(PrintToConsole); log ger.Invoke (&quot;message&quot;); } public static void PrintToConsole(string message) { Console.WriteLine(message); } } public class Logger { public delegate void Log(string message); private static Log logList; public static void Main(string[] args) { logList += new Log(PrintToConsole); logList += new Log(PrintTo File ); logList (&quot;message&quot;); } public static void PrintToConsole (string message) { … } public static void PrintTo File (string message) { … } } public class Logger { public delegate void Log(string message); public static event Log logList ; public static void Main(string[] args) { logList += PrintToConsole; logList += PrintTo File ; logList (&quot;message&quot;); } public static void PrintToConsole (string message) { … } public static void PrintTo File (string message) { … } }
  • 20. C# - Lambda Funktionen public class Logger { public delegate void Log(string message); private static Log logList; public static void Main(string[] args) { logList = delegate(string message) { Console.WriteLine(message); }; logList(&quot;message&quot;); } } public class Logger { public delegate void Log(string message); private static Log logList; public static void Main(string[] args) { logList = message => { Console.WriteLine(message); }; logList(&quot;message&quot;); } } List <int> evenNumbers = list.FindAll( i => (i%2) == 0 );
  • 21.
  • 22.
  • 23. C# - Constructors public class Point { public Point(int x, int y) { X = x; Y = y; } public Point() { } public int X { get; set; } public int Y { get; set; } } Point p = new Point(1, 2) Point p = new Point() P.X = 1; p.Y = 2; Point p = new Point { X = 1, Y = 2 }
  • 24. C# - Constructors public class Point { public int X { get; set; } public int Y { get; set; } } public class Rectangle { public Point topLeft { get; set; } public Point bottomRight { get; set; } } Rectangle r = new Rectangle { topLeft = new Point{ X = 0, Y = 0 }, bottomRight = new Point { X = 2, Y = 2 } } Rectangle r = new Rectangle(); Point p1 = new Point(); p1.X = 0; p1.Y = 0; Point p2 = new Point(); p2.X = 2; p2.Y = 2; r.topLeft = p1; r.bottomRight = p2;
  • 25.
  • 26.
  • 27.
  • 28. C# - Method Calls void FunctionA( ref int Val) { int x= Val; Val = x* 4; } int a= 5; FunctionA( ref a); Console.WriteLine(a); bool GetNodeValue( out int Val) { Val = 1; return true; } int Val; GetNodeValue(Val); Console.WriteLine(a); void Func(params int[] array) { Console.WriteLine(array.Length); } Func(1); Func(7,9); Func(new int[] {3,8,10});
  • 29. C# - Extension Methods public static class ExtensionClass { public static int MultiplyByTwo( this int number) { return number * 2; } } public class Class1 { public static void Main(string[] args) { int number = 2; Console.WriteLine( number.MultiplyByTwo() ); } }
  • 30. C# - Casting object [] myObjects = new object[1] myObjects[0] = new MyClass1(); string s; // Exception s = (string) myObjects[0] public static explicit operator String(MyClass1) { return “SomeString”; } If (myObjects[0] is string) { s = (string) myObjects[1] } s = myObjects[0] as string
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.  

Editor's Notes

  1. Coding Guidelines Sprache