none
Detecting File Attributes using LINQ? RRS feed

  • Question

  • Hello,

     Would using LINQ work better in cases where the method is used on Mac OS where its Big Indian usage?

    I am not sure how to use LINQ syntax, so any help is kindly appreciated.

      Please read, reference;  Post Using IF/Else

     Thanks :)

    Monday, November 6, 2017 12:42 PM

Answers

  • Personally I would just use string interpolation and call it done. But Alberto's answer seems reasonable if you want to go that route. It isn't going to really matter too much performance wise. I find the string interpolation easier to read.

    LINQ is probably not a good choice here because you're not enumerate a set of results. You're enumerating flags of an enum. Could it be done with LINQ? Probably. Would it be better (more readable, faster, etc)? I doubt it.  Everybody seems to want to use LINQ these days for everything and, many times, it isn't the right answer. This is one of those cases.


    Michael Taylor http://www.michaeltaylorp3.net

    • Marked as answer by User3DX Monday, November 6, 2017 10:16 PM
    Monday, November 6, 2017 9:37 PM
    Moderator

All replies

  • LINQ has nothing to do big endianness of an OS. It is a query language. Please provide an explanation of the issue you're having. The link you referred to doesn't seem to have anything to do with LINQ.

    Michael Taylor http://www.michaeltaylorp3.net

    Monday, November 6, 2017 3:02 PM
    Moderator
  • Hello,

     Thanks for reply. I was wondering if there would be an issue using Alberto Poblacion

    solution of bit shift when the method was applied cross platform on a Mac OS?  While

    both replies from my posting was acceptable, I did choose the Dictionary method.  But,

    I also wanted to know if LINQ would work as well.

     

     Thanks :)

    Monday, November 6, 2017 9:17 PM
  • Personally I would just use string interpolation and call it done. But Alberto's answer seems reasonable if you want to go that route. It isn't going to really matter too much performance wise. I find the string interpolation easier to read.

    LINQ is probably not a good choice here because you're not enumerate a set of results. You're enumerating flags of an enum. Could it be done with LINQ? Probably. Would it be better (more readable, faster, etc)? I doubt it.  Everybody seems to want to use LINQ these days for everything and, many times, it isn't the right answer. This is one of those cases.


    Michael Taylor http://www.michaeltaylorp3.net

    • Marked as answer by User3DX Monday, November 6, 2017 10:16 PM
    Monday, November 6, 2017 9:37 PM
    Moderator
  • Hello,

     Thanks for reply. You gave me exactly the answers I was looking.

    Very appreciated. :)

    Monday, November 6, 2017 10:16 PM