Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
5
Answers
If list contain duplicate value then get total count - C#
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Mani Kandan
7y
302
1
Reply
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)
/*How can do here?*/
}).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.
Post
Reset
Cancel
Answers (
5
)
Next Recommended Forum
Crystal Report throwing Missing Parameter while PDF export
data table to another data table