Browse Source

Minor grammatical fixes for Entities

pull/826/head
Hsu Still 8 years ago
parent
commit
9619654ad1
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      docs/guides/concepts/entities.md

+ 7
- 4
docs/guides/concepts/entities.md View File

@@ -12,7 +12,7 @@ Discord API.
### Inheritance ### Inheritance


Due to the nature of the Discord API, some entities are designed with Due to the nature of the Discord API, some entities are designed with
multiple variants, for example, `SocketUser` and `SocketGuildUser`.
multiple variants; for example, `SocketUser` and `SocketGuildUser`.


All models will contain the most detailed version of an entity All models will contain the most detailed version of an entity
possible, even if the type is less detailed. possible, even if the type is less detailed.
@@ -61,8 +61,11 @@ a variant of the type that you need.
### Tips ### Tips


Avoid using boxing-casts to coerce entities into a variant, use the Avoid using boxing-casts to coerce entities into a variant, use the
`as` keyword, and a null-conditional operator.
[`as`] keyword, and a null-conditional operator instead.


This allows you to write safer code, and avoid InvalidCastExceptions.
This allows you to write safer code and avoid [InvalidCastExceptions].


For example, `(message.Author as SocketGuildUser)?.Nickname`.
For example, `(message.Author as SocketGuildUser)?.Nickname`.

[`as`]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/as
[InvalidCastExceptions]: https://msdn.microsoft.com/en-us/library/system.invalidcastexception(v=vs.110).aspx

Loading…
Cancel
Save