Define variable type conditionally C#
问题 In "ADO.NET Entity Data Model" I have created a "database first" model from a number of tables. All tables have "code" and "name" fields and different set of other fields. Then I've created a "context" object. Now I want to create a variable "src_table", which will be assigned to context.table1 or context.table2 etc conditionally and then work with src_table.code and src_table.name properties. A code like this works fine: var context = new postgresEntities(); var src_table = context.table1;