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 82b79dc
Showing 1 changed file with 5 additions and 22 deletions.
27 changes: 5 additions & 22 deletions docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,8 @@ 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");
}
Expand Down Expand Up @@ -146,30 +142,17 @@ 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);
}

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 82b79dc

Please sign in to comment.