Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion docs/user-guide/06-interfaces-generics.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,25 @@ interface IFoo
{
property int count {get; set;}
}

struct MyObject : IFoo
{
int myCount = 0;
property int count
{
get { return myCount; }
set { myCount = newValue; }
}
}
```
The above listing declares that any conforming type must define a property named `count` with both a `getter` and a `setter` method. You can then access the concrete value stored in the property as you would normally.

```csharp
MyObject obj;
obj.count = 2;

int count2 = obj.count; // count2 = 2
```
The above listing declares that any conforming type must define a property named `count` with both a `getter` and a `setter` method.

### Generic Methods

Expand Down