

Programmers who program “in” a language limit their thoughts to constructs that the language directly supports. If the language tools are primitive, the programmer’s thoughts will also be primitive. Programmers who program “into” a language first decide what thoughts they want to express, and then they determine how to express those thoughts using the tools provided by their specific language.
Quelle: @McConnell2004
Objektorientierung
Funktionale Programmierung
using System;
namespace Acme.Collections
{
public class Stack
{
Entry top;
public void Push(object data)
{
top = new Entry(top, data);
}
public object Pop()
{
if (top == null)
{
throw new InvalidOperationException();
}
object result = top.data;
top = top.next;
return result;
}
class Entry
{
public Entry next;
public object data;
public Entry(Entry next, object data)
{
this.next = next;
this.data = data;
}
}
}
}sbyte, short,
int, longbyte, ushort,
uint, ulongcharfloat, doubledecimalboolenum E {...}struct S {...}null: beispielsweise int?objectstringclass C {...}interface I {...}int[] oder int[,]delegate int D(...)public: Keine Einschränkungprotected: Zugriff aus dieser oder abgeleiteten
Klasseninternal: Zugriff aus dem Assemblyprotected internal: Zugriff beschränkt auf umgebende
Klasse oder daraus abgeleiteten Klassenprivate: Zugriff nur aus dieser Klasseprivate protected: Zugriff beschränkt auf umgebende
Klasse oder daraus abgeleiteten Klassen im gleichen Assemblypublic int Length { get; set; }Zum Paketmanagement wird NuGet (https://www.nuget.org) genutzt
System.Runtime: Essentielles Paket u.a. mit
Object, String, Array,
Action und IList<T>System.Collections: Größtenteils generische
Datenstrukturen u.a. mit List<T> und
Dictionary<TKey,TValue>System.Net.Http: Typen für HTTP Netzwerkkommunikation,
u.a. mit HttpClient und
HttpResponseMessageSystem.IO.FileSystem: Typen zum Lesen und Schreiben von
lokalen oder Netzspeichern u.a. mit File und
DirectorySystem.Linq: Typen um Objekte abzufragen, u.a. mit
Enumerable und
ILookup<TKey,TElement>System.Reflection: Typen zum Laden, Inspizieren und
Aktivieren von Typen, u.a. mit Assembly,
TypeInfo und MethodInfoMeist PascalCase und camelCase:
PascalCase für alle public Members, Typen und
NamespacescamelCasefür Parameternamen| Element | Regel | Beispiel |
|---|---|---|
| Namespace | Pascal | namespace System.Security { ... } |
| Type | Pascal | public class StreamReader { ... } |
| Interface | Pascal | public interface IEnumerable { ... } |
| Method | Pascal | public virtual string ToString(); |
| Property | Pascal | public int Length { get; } |
| Event | Pascal | public event EventHandler Exited; |
| Field | Pascal | public static readonly TimeSpan InfiniteTimeout; |
| Enum value | Pascal | public enum FileMode { Append,... } |
| Element | Regel | Beispiel |
|---|---|---|
| Parameter | Camel | public static int ToInt32(string value); |
Unter dem Menüpunkt Hilfe finden Sie Visual Studio Documentation