CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: LINQ with ref parameter

  1. #1
    Join Date
    Jun 2016

    LINQ with ref parameter


    I'd like to know if it's possible to get a collection of something with LINQ with the 'where' clause equal to a function that has a ref parameter.

    var objCol  = from id in ids
                            where id.GetValue(2, ref strValue) == "6"
                            select id;
    The result should be based on the ref value.


  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004

    Re: LINQ with ref parameter

    No, but you can write an extension for whatever class is represented by the ids collection.

    In the extension, create a property and inside the property, call the GetValue method and return the value .

    It'll look something like
    var objCol  = from id in ids
                            where id.MyProperty == "6"
                            select id;
    Last edited by Arjay; August 5th, 2016 at 07:21 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)