Hi Apeksha,
Check this example.
Class
public class CopyData
{
public int Id { get; set; }
public string Name { get; set; }
public string Country { get; set; }
}
public class tblSoftGoodsData
{
public int Id { get; set; }
public string Name { get; set; }
public string Country { get; set; }
}
VB.Net
Public Class CopyData
Public Property Id As Integer
Public Property Name As String
Public Property Country As String
End Class
Public Class tblSoftGoodsData
Public Property Id As Integer
Public Property Name As String
Public Property Country As String
End Class
Code
C#
List<CopyData> tbl1 = new List<CopyData>();
List<tblSoftGoodsData> tbl2 = db.tblSoftGoodsDatas.Where(z => z.BATCH == ii).ToList();
tbl1 = tbl2.Select(x => new CopyData
{
Id = Convert.ToInt32(x.Id),
Name = x.Name,
Country = x.Country
}).ToList();
VB.Net
Dim tbl1 As List(Of CopyData) = New List(Of CopyData)()
Dim tbl2 As List(Of tblSoftGoodsData) = db.tblSoftGoodsDatas.Where(Function(z) z.BATCH = ii).ToList()
tbl1 = tbl2.[Select](Function(x) New CopyData With {
.Id = Convert.ToInt32(x.Id),
.Name = x.Name,
.Country = x.Country
}).ToList()