Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Levente Kosa 73 posts 195 karma points
    1 week ago
    Levente Kosa
    0

    Remove duplications form list

    Hi,

    I try to figure out how to remove duplications from this list, but I can't. I though I can use distinct like here:

    var plots = development.Children.Where(x => x.IsVisible());
    
    foreach (var plot in plots.Select(x => x.Value("bedrooms")).Distinct()) {
        <p>@plot</p>
    }
    

    Any idea how should I fix it?

  • Shaishav Karnani from digitallymedia.com 330 posts 1536 karma points
    6 days ago
    Shaishav Karnani from digitallymedia.com
    0

    Hi,

    What type of datatype is bedrooms property. If it has been string or integer then it will allow but if it is iPublishedContent then it will not work.

    Please can you confirm.

    Regards,

    Shaishav

  • Levente Kosa 73 posts 195 karma points
    6 days ago
    Levente Kosa
    0

    Hi,

    It's a numeric field.

    Thanks, Levente

  • Levente Kosa 73 posts 195 karma points
    6 days ago
    Levente Kosa
    0

    So should it work with this code?

Please Sign in or register to post replies

Write your reply to:

Draft