error:1 only assignment call increment decrement and new object can be used.
error :2 ;expected
im getting these two error in the line which is blocked letters.. plz any one clear this error as soon as possible.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PopulateUploadedFiles();
}
}
private void PopulateUploadedFiles()
{
DirectoryInfo di = new DirectoryInfo(Server.MapPath("~/UploadedFiles"));
List<UploadFile> uploadedFiles = new List<UploadFile>();
foreach (var file in di.GetFiles())
{
uploadedFiles.Add
{
new UploadFile
{
FileName = file.Name,
FileExtension = Path.GetExtension(file.Name),
FilePath = file.FullName,
Size = (file.Length/1024),
Icon = GetIconPath(Path.GetExtension(file.FullName))
}
};
}
DataList1.DataSource = uploadedFiles;
DataList1.DataBind();
}