Discord.Net/docs/guides/entities/samples/safety-cast-var.cs

10 lines
253 B
C#
Raw Permalink Normal View History

2024-06-12 22:43:59 -07:00
IUser user;
// Here we can pre-define the actual declaration of said IGuildUser object,
// so we don't need to cast additionally inside of the statement.
if (user is IGuildUser guildUser)
{
Console.WriteLine(guildUser.JoinedAt);
}
// Check failed.