microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
Libraries/Microsoft.Teams.Api/Activities/Activity.Convertible.cs
41lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | namespace Microsoft.Teams.Api.Activities; |
| 5 | |
| 6 | public partial class Activity : IConvertible |
| 7 | { |
| 8 | public TypeCode GetTypeCode() => TypeCode.Object; |
| 9 | public bool ToBoolean(IFormatProvider? provider) => throw new NotImplementedException(); |
| 10 | public byte ToByte(IFormatProvider? provider) => throw new NotImplementedException(); |
| 11 | public char ToChar(IFormatProvider? provider) => throw new NotImplementedException(); |
| 12 | public DateTime ToDateTime(IFormatProvider? provider) => throw new NotImplementedException(); |
| 13 | public decimal ToDecimal(IFormatProvider? provider) => throw new NotImplementedException(); |
| 14 | public double ToDouble(IFormatProvider? provider) => throw new NotImplementedException(); |
| 15 | public short ToInt16(IFormatProvider? provider) => throw new NotImplementedException(); |
| 16 | public int ToInt32(IFormatProvider? provider) => throw new NotImplementedException(); |
| 17 | public long ToInt64(IFormatProvider? provider) => throw new NotImplementedException(); |
| 18 | public sbyte ToSByte(IFormatProvider? provider) => throw new NotImplementedException(); |
| 19 | public float ToSingle(IFormatProvider? provider) => throw new NotImplementedException(); |
| 20 | public string ToString(IFormatProvider? provider) => ToString(); |
| 21 | public ushort ToUInt16(IFormatProvider? provider) => throw new NotImplementedException(); |
| 22 | public uint ToUInt32(IFormatProvider? provider) => throw new NotImplementedException(); |
| 23 | public ulong ToUInt64(IFormatProvider? provider) => throw new NotImplementedException(); |
| 24 | |
| 25 | public virtual object ToType(Type type, IFormatProvider? provider) |
| 26 | { |
| 27 | if (type == ActivityType.Command.ToType()) return ToCommand(); |
| 28 | if (type == ActivityType.CommandResult.ToType()) return ToCommandResult(); |
| 29 | if (type == ActivityType.ConversationUpdate.ToType()) return ToConversationUpdate(); |
| 30 | if (type == ActivityType.EndOfConversation.ToType()) return ToEndOfConversation(); |
| 31 | if (type == ActivityType.InstallUpdate.ToType()) return ToInstallUpdate(); |
| 32 | if (type == ActivityType.Typing.ToType()) return ToTyping(); |
| 33 | if (type == ActivityType.Message.ToType()) return ToMessage(); |
| 34 | if (type == ActivityType.MessageUpdate.ToType()) return ToMessageUpdate(); |
| 35 | if (type == ActivityType.MessageReaction.ToType()) return ToMessageReaction(); |
| 36 | if (type == ActivityType.MessageDelete.ToType()) return ToMessageDelete(); |
| 37 | if (type == ActivityType.Event.ToType()) return ToEvent(); |
| 38 | if (type == ActivityType.Invoke.ToType()) return ToInvoke(); |
| 39 | return this; |
| 40 | } |
| 41 | } |