From 64f0fd2396d972871a8acb8eb618986922d49afd Mon Sep 17 00:00:00 2001 From: Bastian Eicher Date: Fri, 26 Jan 2024 01:14:48 +0100 Subject: [PATCH] Updated C# introduction samples --- docs/introduction.md | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/docs/introduction.md b/docs/introduction.md index bd18b91..3828562 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -81,14 +81,9 @@ TypedRest uses an object-oriented approach to provide you with building blocks f === "C#" ```csharp - class MyClient : EntryEndpoint + class MyClient(Uri uri) : EntryEndpoint(uri) { - public MyClient(Uri uri) - : base(uri) - {} - - public ICollectionEndpoint Contacts - => new CollectionEndpoint(this, relativeUri: "./contacts"); + public CollectionEndpoint Contacts => new(this, relativeUri: "./contacts"); } ``` @@ -146,30 +141,16 @@ Of course, we don't expect our predefined patterns to cover all possible use cas === "C#" ```csharp - class MyClient : EntryEndpoint + class MyClient(Uri uri) : EntryEndpoint(uri) { - public MyClient(Uri uri) : base(uri) - {} - - public ContactCollectionEndpoint Contacts - => new ContactCollectionEndpoint(this); + public ContactCollectionEndpoint Contacts => new(this); } - class ContactCollectionEndpoint : CollectionEndpoint - { - public ContactCollectionEndpoint(IEndpoint referrer) - : base(referrer, relativeUri: "./contacts") - {} - } + class ContactCollectionEndpoint(IEndpoint referrer) : CollectionEndpoint(referrer, relativeUri: "./contacts"); - class ContactEndpoint : ElementEndpoint + class ContactEndpoint(IEndpoint referrer, Uri relativeUri) : ElementEndpoint(referrer, relativeUri) { - public ContactEndpoint(IEndpoint referrer, Uri relativeUri) - : base(referrer, relativeUri) - {} - - public IElementEndpoint Note - => new ElementEndpoint(this, relativeUri: "./note"); + public ElementEndpoint Note => new(this, relativeUri: "./note"); } ```