Max() is an aggregate function used to find the largest value in a set (collection). Your example code is a single item not a collection. Please make a better effort to read the documentation and learn basic C#. Frankly, you code makes no logical sense...
Aggregate Functions (Transact-SQL)
Enumerable.Max Method (Example code is located at the bottom of the documentation)
LINQ Max() example.
class Program
{
static void Main(string[] args)
{
List<Developer> data = PopulateMockData();
int maxId = data.Max(d => d.Id);
Console.WriteLine($"maxId = {maxId}");
int nextId = maxId + 1;
Console.WriteLine($"nextId = {nextId}");
}
public static List<Developer> PopulateMockData()
{
List<Developer> data = new List<Developer>();
for (int i = 0; i < 10; i++)
{
data.Add(new Developer() { Id = i, EnvT = $"Ent_{i}" });
}
return data;
}
}
public partial class Developer
{
public int Id { get; set; }
public string EnvT { get; set; }
}
Results
maxId = 9
nextId = 10