Hello Everyone,
I have list items.
This 3 records contain images, that is image path from database. I want to get total size of the image group by ArchievedName .
1st item,
2nd item,
3rd item,
I have tried,
- List<Tble_Documents> objDocumentUserSetup = new List<Tble_Documents>();
-
- bjDocumentUserSetup = objUserSetUp1.AsEnumerable().Select(m => new Tble_Documents()
- {
- ArchievedName = m.ArchievedName,
- UpdatedDate = m.UpdatedDate,
- Fullname = m.Fullname,
- FilePath = m.FilePath + m.Parent_File_Name + "_" + m.Child_File_Name,
- docCount = m.docCount,
- FileSize = FormatBytes(new System.IO.FileInfo(m.FilePath + m.Parent_File_Name + "_" + m.Child_File_Name).Length)
- }).ToList();
- private static string FormatBytes(long bytes)
- {
- string[] Suffix = { "B", "KB", "MB", "GB", "TB" };
- int i;
- double dblSByte = bytes;
- for (i = 0; i < Suffix.Length && bytes >= 1024; i++, bytes /= 1024)
- {
- dblSByte = bytes / 1024.0;
- }
-
- return String.Format("{0:0.##} {1}", dblSByte, Suffix[i]);
- }
Please help me.