Skip to content

Commit

Permalink
Updated C# introduction samples
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Jan 26, 2024
1 parent eed611b commit 64f0fd2
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<Contact> Contacts
=> new CollectionEndpoint<Contact>(this, relativeUri: "./contacts");
public CollectionEndpoint<Contact> Contacts => new(this, relativeUri: "./contacts");
}
```

Expand Down Expand Up @@ -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<Contact, ContactEndpoint>
{
public ContactCollectionEndpoint(IEndpoint referrer)
: base(referrer, relativeUri: "./contacts")
{}
}
class ContactCollectionEndpoint(IEndpoint referrer) : CollectionEndpoint<Contact, ContactEndpoint>(referrer, relativeUri: "./contacts");

class ContactEndpoint : ElementEndpoint<Contact>
class ContactEndpoint(IEndpoint referrer, Uri relativeUri) : ElementEndpoint<Contact>(referrer, relativeUri)
{
public ContactEndpoint(IEndpoint referrer, Uri relativeUri)
: base(referrer, relativeUri)
{}

public IElementEndpoint<Note> Note
=> new ElementEndpoint<Note>(this, relativeUri: "./note");
public ElementEndpoint<Note> Note => new(this, relativeUri: "./note");
}
```

Expand Down

0 comments on commit 64f0fd2

Please sign in to comment.