private static void GenerateParameterEntityEqualMethod(StructDeclaration type) { var equal = type.AddMember(new MethodDeclaration(nameof(object.Equals))); equal.Modifiers = Modifiers.Public | Modifiers.Override; equal.ReturnType = typeof(bool); var objArg = equal.AddArgument("obj", new TypeReference(typeof(object)).MakeNullable()); equal.Statements = new StatementCollection() { new ConditionStatement { Condition = new IsInstanceOfTypeExpression(objArg, type), TrueStatements = new ReturnStatement(new ThisExpression().CreateInvokeMethodExpression("Equals", new CastExpression(objArg, type))), FalseStatements = new ReturnStatement(LiteralExpression.False()), }, }; }