cars.AsQueryable().Where(c=>c.HasTurbo) for example?

On Mon, Oct 6, 2008 at 8:16 PM, Shane C <[EMAIL PROTECTED]> wrote:

>
> I'm not sure I see how that could work.
>
> My extension method relied on the fact that an IList is really a List
> (in my code bases at least) so all it had to do was a simple cast.  I
> know this isn't the best idea but it worked and I consider it fairly
> safe to do as long as everyone involved understands what's going on.
> Since the functionality lives on List you either need to convert to
> List or take your IEnumerable and wrap it inside a list.
>
> The problem with wrapping a NH IList inside a List is that the methods
> act against the List and not the underlying IList so if you were to do
> RemoveAll you wouldn't actually be removing anything.
>
> I guess the question comes down to how are people removing values from
> NH managed ILists when they need to do it based on some piece of
> information on the actual object?  Simple for loops?
>
> On Oct 6, 11:06 am, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote:
> > Agh, i think using extension methods of IEnumerable should still work.
> >
> >
> >
> > On Mon, Oct 6, 2008 at 8:05 PM, Shane C <[EMAIL PROTECTED]>
> wrote:
> >
> > > In my dream world I own so may cars I forget which ones have turbo
> > > chargers.. so..
> >
> > > List<Car> myCars = new List<Car>();
> >
> > > List<Car> myCarsWithTurbo = cars.FindAll(t => t.HasTurbo)
> >
> > > OR more importantly I want to get rid of my cars that don't have turbo
> > > charges since they're so dang slow...
> >
> > > List<Car> myCars = new List<Car>();
> >
> > > myCars.RemoveAll(t => !t.HasTurbo);
> >
> > > On Oct 6, 10:59 am, "Tuna Toksöz" <[EMAIL PROTECTED]> wrote:
> > > > I didn't get it,can you give me a sample what you could do before?
> >
> > > > On Mon, Oct 6, 2008 at 7:57 PM, Shane C <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > I'm very use to using the full functionality of List<T>
> > > > > (.Find, .Exists, etc) but now that I'm using NH I find I've lost
> > > > > access to this.  In .Net 2.0/3.0 I could make a IRichList and in
> .Net
> > > > > 3.5 I could write extension methods to IList that would give me the
> > > > > methods via casting.
> >
> > > > > Since NH is under the covers managing my IList's they are no longer
> > > > > really Lists so casting is out the window now.  I figure I can't be
> > > > > the only person on the earth that used this functionality so if you
> > > > > too were missing these methods were you able to find a way to get
> them
> > > > > back?
> >
> > > > > The only thing I could come up with was creating a new list and
> > > > > calling the method each time I needed it.  That to me seems a might
> > > > > bit nasty.
> >
> > > > > Thanks,
> >
> > > > > Shane
> >
> > > > --
> > > > Tuna Toksöz
> >
> > > > Typos included to enhance the readers attention!
> >
> > --
> > Tuna Toksöz
> >
> > Typos included to enhance the readers attention!
> >
>


-- 
Tuna Toksöz

Typos included to enhance the readers attention!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to