Extract method is a refactoring method that extracts code into its own method. If the extracted part needs parameters they are passed as parameters to the method.
In your code the code is exactly the same except for the field name; The field name would be a parameter to your method.
The result would look like this:
private FieldValidation CreateFieldValidation(string fieldName)
{
return new FieldValidation
{
IsRequired = false,
DataType = "String",
Length = 0,
Min = 0,
Max = 255,
FieldValidationType =
_bancPaydatabase.FieldValidationTypes
.FirstOrDefault(o => o.FieldName == fieldName),
IsVisible = true,
Owner_Country = swedishOwnerCountry
};
}
Usage would be now like this:
FieldValidation swedishFieldValidation1 = CreateFieldValidation("InvoiceNumber");
FieldValidation swedishFieldValidation2 = CreateFieldValidation("InvoiceTypeId");
If owner country would need to change, too, you would also make it a parameter in the method.