Click here to Skip to main content
15,884,388 members
Home / Discussions / C#
   

C#

 
GeneralRe: Find and count duplicates in a list Pin
Acuena24-Aug-20 4:16
Acuena24-Aug-20 4:16 
GeneralRe: Find and count duplicates in a list Pin
OriginalGriff24-Aug-20 4:24
mveOriginalGriff24-Aug-20 4:24 
GeneralRe: Find and count duplicates in a list Pin
Acuena24-Aug-20 5:07
Acuena24-Aug-20 5:07 
GeneralRe: Find and count duplicates in a list Pin
OriginalGriff24-Aug-20 5:39
mveOriginalGriff24-Aug-20 5:39 
GeneralRe: Find and count duplicates in a list Pin
Acuena25-Aug-20 4:13
Acuena25-Aug-20 4:13 
GeneralRe: Find and count duplicates in a list Pin
OriginalGriff25-Aug-20 4:43
mveOriginalGriff25-Aug-20 4:43 
AnswerRe: Find and count duplicates in a list Pin
Afzaal Ahmad Zeeshan20-Aug-20 4:37
professionalAfzaal Ahmad Zeeshan20-Aug-20 4:37 
AnswerRe: Find and count duplicates in a list Pin
BillWoodruff22-Aug-20 21:58
professionalBillWoodruff22-Aug-20 21:58 
Finding duplicates by barcodes is easy; i'd suggest you get your data into an "object" where it will be easy to perform any type of query on it: I'd use a Dictionary:
private readonly string bcdata = @"2020-07-08,13:54:16,1578456329781
2020-07-08,14:07:13,1578453697235
2020-07-08,14:08:03,1548795358155
2020-07-08,14:11:09,1578453697235
2020-07-08,14:11:42,1578453697235";

private char[] splitwhtspc = {'\r', '\n', ' ', '\t'};
private char[] splitcomma = {','};

// in some method or event-handler body:

var lines = bcdata.Split(splitwhtspc, StringSplitOptions.RemoveEmptyEntries);

Dictionary<DateTime, Int64> dttobc = lines.Select
(
    line => line.Split(splitcomma, StringSplitOptions.RemoveEmptyEntries)
).Select
(
    sary =>
        new
        {
            key = DateTime.Parse(sary[0] + " " + sary[1]),
            value = long.Parse(sary[2])
        }
)
.ToDictionary(
    kl => kl.key,
    vl => vl.value
);
Using this Dictionary, you can easily create a new Dictionary of barcodes and number of barcodes:
C#
Dictionary<long, int> dups = dttobc.Values.GroupBy(v => v).ToDictionary(g => g.Key, g => g.Count());

«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali

QuestionPowerApps and C# Pin
Member 1127440117-Aug-20 6:08
Member 1127440117-Aug-20 6:08 
AnswerRe: PowerApps and C# Pin
Dave Kreskowiak17-Aug-20 7:42
mveDave Kreskowiak17-Aug-20 7:42 
QuestionBinding picture box with column with oracle Pin
mohammed alherwi14-Aug-20 23:26
mohammed alherwi14-Aug-20 23:26 
AnswerRe: Binding picture box with column with oracle Pin
Eddy Vluggen22-Aug-20 10:11
professionalEddy Vluggen22-Aug-20 10:11 
QuestionHow to Read and Write to RFID(v9t557) as Human Interface Device C# Pin
Member 1177073713-Aug-20 14:10
Member 1177073713-Aug-20 14:10 
AnswerRe: How to Read and Write to RFID(v9t557) as Human Interface Device C# Pin
Dave Kreskowiak13-Aug-20 16:28
mveDave Kreskowiak13-Aug-20 16:28 
GeneralRe: How to Read and Write to RFID(v9t557) as Human Interface Device C# Pin
Member 1177073714-Aug-20 12:40
Member 1177073714-Aug-20 12:40 
GeneralRe: How to Read and Write to RFID(v9t557) as Human Interface Device C# Pin
Dave Kreskowiak14-Aug-20 13:16
mveDave Kreskowiak14-Aug-20 13:16 
GeneralRe: How to Read and Write to RFID(v9t557) as Human Interface Device C# Pin
Member 1177073714-Aug-20 13:28
Member 1177073714-Aug-20 13:28 
GeneralRe: How to Read and Write to RFID(v9t557) as Human Interface Device C# Pin
Dave Kreskowiak14-Aug-20 17:26
mveDave Kreskowiak14-Aug-20 17:26 
GeneralRe: How to Read and Write to RFID(v9t557) as Human Interface Device C# Pin
Member 1177073714-Aug-20 20:18
Member 1177073714-Aug-20 20:18 
GeneralRe: How to Read and Write to RFID(v9t557) as Human Interface Device C# Pin
Dave Kreskowiak15-Aug-20 4:03
mveDave Kreskowiak15-Aug-20 4:03 
GeneralRe: How to Read and Write to RFID(v9t557) as Human Interface Device C# Pin
OriginalGriff15-Aug-20 2:31
mveOriginalGriff15-Aug-20 2:31 
QuestionHow to generate random decimal numbers in C# Pin
Sajo Nezic12-Aug-20 6:02
Sajo Nezic12-Aug-20 6:02 
AnswerRe: How to generate random decimal numbers in C# Pin
OriginalGriff12-Aug-20 6:09
mveOriginalGriff12-Aug-20 6:09 
AnswerRe: How to generate random decimal numbers in C# Pin
Luc Pattyn12-Aug-20 10:15
sitebuilderLuc Pattyn12-Aug-20 10:15 
AnswerRe: How to generate random decimal numbers in C# Pin
Eddy Vluggen13-Aug-20 12:07
professionalEddy Vluggen13-Aug-20 12:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.