Getting type from a symbol in roslyn

后端 未结 2 1652
一整个雨季
一整个雨季 2021-01-04 11:30

What is the best general purpose way to get a System.Type from Microsoft.CodeAnalysis.ISymbol for different types of symbols ? (e.g. class declarations, variable, properties

2条回答
  •  耶瑟儿~
    2021-01-04 11:53

    I think this is what you are looking for :

    var castedProperty = (IPropertySymbol) property;
    var type = castedProperty.Type.Name;

    ** variable 'property' beeing an ISymbol instance.

提交回复
热议问题