本文整理汇总了C#中UnaryOperatorKind.OperandTypes方法的典型用法代码示例。如果您正苦于以下问题:C# UnaryOperatorKind.OperandTypes方法的具体用法?C# UnaryOperatorKind.OperandTypes怎么用?C# UnaryOperatorKind.OperandTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnaryOperatorKind
的用法示例。
在下文中一共展示了UnaryOperatorKind.OperandTypes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSignature
internal UnaryOperatorSignature GetSignature(UnaryOperatorKind kind)
{
TypeSymbol opType = null;
if (kind.IsLifted())
{
var nullable = Compilation.GetSpecialType(SpecialType.System_Nullable_T);
switch (kind.OperandTypes())
{
case UnaryOperatorKind.SByte: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_SByte)); break;
case UnaryOperatorKind.Byte: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_Byte)); break;
case UnaryOperatorKind.Short: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_Int16)); break;
case UnaryOperatorKind.UShort: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_UInt16)); break;
case UnaryOperatorKind.Int: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_Int32)); break;
case UnaryOperatorKind.UInt: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_UInt32)); break;
case UnaryOperatorKind.Long: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_Int64)); break;
case UnaryOperatorKind.ULong: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_UInt64)); break;
case UnaryOperatorKind.Char: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_Char)); break;
case UnaryOperatorKind.Float: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_Single)); break;
case UnaryOperatorKind.Double: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_Double)); break;
case UnaryOperatorKind.Decimal: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_Decimal)); break;
case UnaryOperatorKind.Bool: opType = nullable.Construct(Compilation.GetSpecialType(SpecialType.System_Boolean)); break;
}
}
else
{
switch (kind.OperandTypes())
{
case UnaryOperatorKind.SByte: opType = Compilation.GetSpecialType(SpecialType.System_SByte); break;
case UnaryOperatorKind.Byte: opType = Compilation.GetSpecialType(SpecialType.System_Byte); break;
case UnaryOperatorKind.Short: opType = Compilation.GetSpecialType(SpecialType.System_Int16); break;
case UnaryOperatorKind.UShort: opType = Compilation.GetSpecialType(SpecialType.System_UInt16); break;
case UnaryOperatorKind.Int: opType = Compilation.GetSpecialType(SpecialType.System_Int32); break;
case UnaryOperatorKind.UInt: opType = Compilation.GetSpecialType(SpecialType.System_UInt32); break;
case UnaryOperatorKind.Long: opType = Compilation.GetSpecialType(SpecialType.System_Int64); break;
case UnaryOperatorKind.ULong: opType = Compilation.GetSpecialType(SpecialType.System_UInt64); break;
case UnaryOperatorKind.Char: opType = Compilation.GetSpecialType(SpecialType.System_Char); break;
case UnaryOperatorKind.Float: opType = Compilation.GetSpecialType(SpecialType.System_Single); break;
case UnaryOperatorKind.Double: opType = Compilation.GetSpecialType(SpecialType.System_Double); break;
case UnaryOperatorKind.Decimal: opType = Compilation.GetSpecialType(SpecialType.System_Decimal); break;
case UnaryOperatorKind.Bool: opType = Compilation.GetSpecialType(SpecialType.System_Boolean); break;
}
}
Debug.Assert((object)opType != null);
return new UnaryOperatorSignature(kind, opType, opType);
}