Skip to content

Commit 8d6e954

Browse files
committed
Updated C# introduction samples
1 parent eed611b commit 8d6e954

1 file changed

Lines changed: 9 additions & 26 deletions

File tree

docs/introduction.md

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,9 @@ TypedRest uses an object-oriented approach to provide you with building blocks f
8181
=== "C#"
8282

8383
```csharp
84-
class MyClient : EntryEndpoint
84+
class MyClient(Uri uri) : EntryEndpoint(uri)
8585
{
86-
public MyClient(Uri uri)
87-
: base(uri)
88-
{}
89-
90-
public ICollectionEndpoint<Contact> Contacts
91-
=> new CollectionEndpoint<Contact>(this, relativeUri: "./contacts");
86+
public CollectionEndpoint<Contact> Contacts => new(this, relativeUri: "./contacts");
9287
}
9388
```
9489

@@ -146,30 +141,18 @@ Of course, we don't expect our predefined patterns to cover all possible use cas
146141
=== "C#"
147142

148143
```csharp
149-
class MyClient : EntryEndpoint
144+
class MyClient(Uri uri) : EntryEndpoint(uri)
150145
{
151-
public MyClient(Uri uri) : base(uri)
152-
{}
153-
154-
public ContactCollectionEndpoint Contacts
155-
=> new ContactCollectionEndpoint(this);
146+
public ContactCollectionEndpoint Contacts => new(this);
156147
}
157148

158-
class ContactCollectionEndpoint : CollectionEndpoint<Contact, ContactEndpoint>
159-
{
160-
public ContactCollectionEndpoint(IEndpoint referrer)
161-
: base(referrer, relativeUri: "./contacts")
162-
{}
163-
}
149+
class ContactCollectionEndpoint(IEndpoint referrer)
150+
: CollectionEndpoint<Contact, ContactEndpoint>(referrer, relativeUri: "./contacts");
164151

165-
class ContactEndpoint : ElementEndpoint<Contact>
152+
class ContactEndpoint(IEndpoint referrer, Uri relativeUri)
153+
: ElementEndpoint<Contact>(referrer, relativeUri)
166154
{
167-
public ContactEndpoint(IEndpoint referrer, Uri relativeUri)
168-
: base(referrer, relativeUri)
169-
{}
170-
171-
public IElementEndpoint<Note> Note
172-
=> new ElementEndpoint<Note>(this, relativeUri: "./note");
155+
public ElementEndpoint<Note> Note => new(this, relativeUri: "./note");
173156
}
174157
```
175158

0 commit comments

Comments
 (0)