SlideShare ist ein Scribd-Unternehmen logo
1 von 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]
 

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876dlhescort
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxAndy Lambert
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Sheetaleventcompany
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayNZSG
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Neil Kimberley
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture conceptP&CO
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noidadlhescort
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Dipal Arora
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...lizamodels9
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...lizamodels9
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756dollysharma2066
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...amitlee9823
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Centuryrwgiffor
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageMatteo Carbone
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesDipal Arora
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityEric T. Tung
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...allensay1
 

Kürzlich hochgeladen (20)

Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
Call Girls in Delhi, Escort Service Available 24x7 in Delhi 959961-/-3876
 
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in indiaFalcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in india
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptx
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023Mondelez State of Snacking and Future Trends 2023
Mondelez State of Snacking and Future Trends 2023
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture concept
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service NoidaCall Girls In Noida 959961⊹3876 Independent Escort Service Noida
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 

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.  

Hinweis der Redaktion

  1. Coding Guidelines Sprache