* Added ReplyKeyboardMarkupGenerator
* Added set of markup attributes dedicatedf to map a keyboard using partial methods
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
namespace Telegrator.RoslynExtensions;
|
||||
|
||||
public static class SymbolsExtensions
|
||||
{
|
||||
public static bool IsAssignableFrom(this ITypeSymbol symbol, string className)
|
||||
{
|
||||
if (symbol.BaseType == null)
|
||||
return false;
|
||||
|
||||
if (symbol.BaseType.Name == className)
|
||||
return true;
|
||||
|
||||
return symbol.BaseType.IsAssignableFrom(className);
|
||||
}
|
||||
|
||||
public static ITypeSymbol? Cast(this ITypeSymbol symbol, string className)
|
||||
{
|
||||
if (symbol.BaseType == null)
|
||||
return null;
|
||||
|
||||
if (symbol.BaseType.Name == className)
|
||||
return symbol.BaseType;
|
||||
|
||||
return symbol.BaseType.Cast(className);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user