Is type of float using Roslyn? - CSharp Microsoft.CodeAnalysis

CSharp examples for Microsoft.CodeAnalysis:Roslyn

Description

Is type of float using Roslyn?

Demo Code


using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis;

public class Main{
        /// <summary>
        /// Is type of float?
        /// </summary>
        /// <param name="symbol"></param>
        /// <returns></returns>
        public static bool IsFloat(this ITypeSymbol symbol)
        {/* w w w.  j av  a 2s . com*/
            if (symbol == null) return false;
            return symbol.MetadataName == "Single";
        }
}

Related Tutorials