diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/user-guide/04-interfaces-generics.md | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/docs/user-guide/04-interfaces-generics.md b/docs/user-guide/04-interfaces-generics.md index a095b645d..ec79daad8 100644 --- a/docs/user-guide/04-interfaces-generics.md +++ b/docs/user-guide/04-interfaces-generics.md @@ -59,8 +59,7 @@ int myGenericMethod<T: IFoo>(T arg) The above listing defines a generic method named `myGenericMethod`, which accepts an argument that can be of any type `T` as long as `T` conforms to the `IFoo` interface. The `T` here is called a _generic type parameter_, and it is associated with an _type constraint_ that any type represented by `T` must conform to the interface `IFoo`. The following listing shows how to invoke a generic method: -``` -C# +```C# MyType obj; int a = myGenericMethod<MyType>(obj); // OK, explicit type argument int b = myGenericMethod(obj); // OK, automatic type deduction @@ -679,4 +678,4 @@ void test() int b = f2.bar(); // b == 1, calling the existing method in `MyFoo2`. } ``` -This feature is similar to extension traits in Rust.
\ No newline at end of file +This feature is similar to extension traits in Rust. |
