Click here to Skip to main content
15,893,564 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I find out what "USB Serial Device" is called in all other languages? Pin
Dave Kreskowiak30-Jun-20 11:59
mveDave Kreskowiak30-Jun-20 11:59 
AnswerRe: How can I find out what "USB Serial Device" is called in all other languages? Pin
Luc Pattyn30-Jun-20 12:35
sitebuilderLuc Pattyn30-Jun-20 12:35 
GeneralRe: How can I find out what "USB Serial Device" is called in all other languages? Pin
arnold_w30-Jun-20 19:52
arnold_w30-Jun-20 19:52 
GeneralRe: How can I find out what "USB Serial Device" is called in all other languages? Pin
kalberts1-Jul-20 0:09
kalberts1-Jul-20 0:09 
GeneralRe: How can I find out what "USB Serial Device" is called in all other languages? Pin
arnold_w1-Jul-20 0:15
arnold_w1-Jul-20 0:15 
GeneralRe: How can I find out what "USB Serial Device" is called in all other languages? Pin
Luc Pattyn1-Jul-20 1:08
sitebuilderLuc Pattyn1-Jul-20 1:08 
GeneralRe: How can I find out what "USB Serial Device" is called in all other languages? Pin
arnold_w1-Jul-20 1:58
arnold_w1-Jul-20 1:58 
GeneralRe: How can I find out what "USB Serial Device" is called in all other languages? Pin
Luc Pattyn1-Jul-20 2:08
sitebuilderLuc Pattyn1-Jul-20 2:08 
GeneralRe: How can I find out what "USB Serial Device" is called in all other languages? Pin
arnold_w1-Jul-20 2:12
arnold_w1-Jul-20 2:12 
QuestionVS2017 publish project to .exe without manifest files Pin
Member 1487747430-Jun-20 10:35
Member 1487747430-Jun-20 10:35 
AnswerRe: VS2017 publish project to .exe without manifest files Pin
Dave Kreskowiak30-Jun-20 11:15
mveDave Kreskowiak30-Jun-20 11:15 
QuestionOptimize Linq To SQL Query Pin
Kevin Marois30-Jun-20 8:21
professionalKevin Marois30-Jun-20 8:21 
QuestionC# Pin
Member 1258896327-Jun-20 5:30
Member 1258896327-Jun-20 5:30 
AnswerRe: C# Generate a password dictionary to log into API Pin
OriginalGriff27-Jun-20 5:49
mveOriginalGriff27-Jun-20 5:49 
GeneralRe: C# Generate a password dictionary to log into API Pin
Member 1258896327-Jun-20 5:59
Member 1258896327-Jun-20 5:59 
GeneralRe: C# Generate a password dictionary to log into API Pin
OriginalGriff27-Jun-20 6:00
mveOriginalGriff27-Jun-20 6:00 
GeneralRe: C# Generate a password dictionary to log into API Pin
Dave Kreskowiak27-Jun-20 7:10
mveDave Kreskowiak27-Jun-20 7:10 
QuestionBest way to transform list and get top result from custom sort order? Pin
linalinea26-Jun-20 9:44
linalinea26-Jun-20 9:44 
AnswerRe: Best way to transform list and get top result from custom sort order? Pin
OriginalGriff26-Jun-20 11:28
mveOriginalGriff26-Jun-20 11:28 
GeneralRe: Best way to transform list and get top result from custom sort order? Pin
Richard Deeming29-Jun-20 0:21
mveRichard Deeming29-Jun-20 0:21 
AnswerRe: Best way to transform list and get top result from custom sort order? Pin
jsc4229-Jun-20 5:51
professionaljsc4229-Jun-20 5:51 
It looks like you are only looking for the highest single item, not getting a complete sorted list, which is what your question seems to imply that you are looking for. But on the assumption that the .FirstOrDefault does give you what you want ...

I am not sure whether any efficiency savings would be sufficiently significant, but I would consider combining the priorities into a single value using const / enums rather than using dictionary lookups and only sorting the list once against a single key. e.g. (my C# is a little rusty, so forgive syntax errors)

C#
[Flags]
enum YourRevisedPriority
{
   SuperUser     = &x0000, 
   NormalUser    = &x0100, 
   Beginner      = &x0200,

   Internal      = &x0000,
   External      = &x0010,

   Valid         = &x0000,
   ValidInFuture = &x0001,
   Expire        = &x0002
}

TransformedProfile = profileList.Select(x => new TransformedProfile
    {
    ProfileType = GetProfileType(x.PropertyA),
    // ProfileSubType = GetProfileSubType(x.PropertyB),
    ProfileValidity = GetValidity(x.StartDate, x.ExpiryDate),
    NewPriority = 
      (ProfileType == SourceEnum.SuperUser ? YourRevisedPriority.SuperUser : (ProfileType == SourceEnum.NormalUser ? YourRevisedPriority.NormalUser : YourRevisedPriority.Beginner)) +
      (GetProfileSubType(x.PropertyB) == SourceEnum.Internal ? YourRevisedPriority.Internal : YourRevisedPriority.External) +
      (ProfileValidity == SourceEnum.Valid ? YourRevisedPriority.Valid : (ProfileValidity == SourceEnum.ValidInFuture ? YourRevisedPriority.ValidInFuture : YourRevisedPriority.Expire))
    })
    .OrderBy(y => y.NewPriority)
    .FirstOrDefault();

AnswerRe: Best way to transform list and get top result from custom sort order? Pin
linalinea3-Jul-20 9:59
linalinea3-Jul-20 9:59 
GeneralRe: Best way to transform list and get top result from custom sort order? Pin
OriginalGriff3-Jul-20 10:49
mveOriginalGriff3-Jul-20 10:49 
QuestionCustomizable keybinds C# Pin
Member 1486815919-Jun-20 14:28
Member 1486815919-Jun-20 14:28 
AnswerRe: Customizable keybinds C# Pin
OriginalGriff19-Jun-20 20:10
mveOriginalGriff19-Jun-20 20:10 

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.