Skip to content

Warn if notnull and nullcheck #251

@JohanLarsson

Description

@JohanLarsson
private static bool IsReferenceTypeCreation(ObjectCreationExpressionSyntax objectCreation, SyntaxNodeAnalysisContext context)
{
    if (objectCreation == null)
    {
        return false;
    }

    var type = context.SemanticModel.GetTypeInfoSafe(objectCreation, context.CancellationToken)
                      .Type;
    if (type.IsValueType)
    {
        return false;
    }

    return true;
}

In private methods

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions