I have this entity class Map and I have created another partial class that implements the interface which basically carries common properties that is shared among classes.
namespace entity
{
public partial class Map
{
public Guid Id { get; set; }
public DateTime date1 { get; set; }
public DateTime date2 { get; set; }
public int? test1 { get; set; }
public int? test2 { get; set; }
}
public partial class Map : ICommonFields
{
}
}
namespace Test
{
public interface ICommonFields
{
Guid Id { get; set; }
DateTime date1 { get; set; }
DateTime date2 { get; set; }
}
}
Now, in my code I get List
of class Map
check(List<Map>);
private void check(List<ICommonFields> co)
{
// do something
}
I get this error
"cannot convert from system.collections.generic.list map to system.collections.generic.list ICommonfields"
How can I do this conversion, since I am only interested in common field Id
, date1
and date2
?