I am trying to write a custom c# 8 refactoring on classes that are using the new nullable syntax.
I tell the difference between between the "actual" types and the "nullable" types by checking for the "?" at the end of the type name.
The problem is how do I know which variables need a ".Value" to get the value and which variables dont?
For example:
#nullable enable
public class C
{
public int actualInt {get; set;}
public int? nullableInt {get; set;}
public string actualString {get; set;}
public string? nullableString {get; set;}
}
Once I have the symantic model, I can get the symbol information like this:
IPropertySymbol symbolInfo = SemanticModel.GetDeclaredSymbol(property) as IPropertySymbol;
But for "actualInt", I see that it is has
symbolInfo.Type.Name == "Int32" (good)
IsReferenceType == true (huh?)
IsValueType == false (huh?)
I would have expected to see IsValueType == true