summaryrefslogtreecommitdiffstats
path: root/docs/user-guide
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-03-30 14:08:38 -0700
committerGitHub <noreply@github.com>2021-03-30 14:08:38 -0700
commit5fefb120e0c2469563e937f4ee39b391d7678cdf (patch)
tree5746d5b86cb524d463dbbce70cebf995313f4d3c /docs/user-guide
parent59fdf73861032191a7d842c99df08dab2a6bc55b (diff)
Update 04-interfaces-generics.md
Diffstat (limited to 'docs/user-guide')
-rw-r--r--docs/user-guide/04-interfaces-generics.md5
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.