Jump to content

The Game  

2 members have voted

  1. 1. what do you think?

    • Great, awesome Job!
      0
    • I like it.
    • Maybe.
      0
    • Needs Work, but keep trying.
      0
    • I have a suggestion...
      0
    • No.
      0
    • Other. (please post)
      0


Recommended Posts

Posted

so this is off topic, but since we're talking programming here, i figured i'd post it here. But i learned something outrageously cool about both C# and vb.net today.

apparently they both have a feature called "LINQ" that lets you query your variables and objects in memory as if they were records in a database.

It's significantly more efficient than looping around an array/collection of objects and testing for a certain condition.

so for example, if we had a collection of objects called "objStuff"

we could do a for...each loop like this

for each e as Entity in objStuff

if e.variable = true then

{l33t codez}

end if

next

but instead, we could use linq and do this:

query = from object as Entity in objStuff where object.variable = true select object

for each e as Entity in query

{l33t codez}

next

Posted

indeed linq is supposed to be pretty. Though I've done plenty of C#/.NET development, I've never really gotten into it. Though my excuse is I'm writing code for hardware guys, who know C better than anything. Though linq is very much more readable I guess...

Posted

indeed linq is supposed to be pretty. Though I've done plenty of C#/.NET development, I've never really gotten into it. Though my excuse is I'm writing code for hardware guys, who know C better than anything. Though linq is very much more readable I guess...

yeah, ive done quite a bit of stuff with c#, and i never even knew it existed. I just happened upon the MSDN entry for it, and it basically blew my mind :P

so of course i immediately set about modifying code that was using for..each loops to use it to see how much quicker the code ran, and after doing so, you can certainly color me impressed.

Posted

so this is off topic, but since we're talking programming here, i figured i'd post it here. But i learned something outrageously cool about both C# and vb.net today.

apparently they both have a feature called "LINQ" that lets you query your variables and objects in memory as if they were records in a database.

It's significantly more efficient than looping around an array/collection of objects and testing for a certain condition.

so for example, if we had a collection of objects called "objStuff"

we could do a for...each loop like this

for each e as Entity in objStuff

if e.variable = true then

{l33t codez}

end if

next

but instead, we could use linq and do this:

query = from object as Entity in objStuff where object.variable = true select object

for each e as Entity in query

{l33t codez}

next

I'm late to the party here, but I did quite a bit of VB and C (no C# though), and that is a ridiculously cool trick.

Posted

for you guys preening over linq, you should check out the languages Scheme or Haskel/Erlang, those are some sweet-chull languages :D lol

Joe

Posted

for you guys preening over linq, you should check out the languages Scheme or Haskel/Erlang, those are some sweet-chull languages :D lol

Joe

scheme....that's based off lisp, isnt it?

i've heard of haskell, but never even looked into it, so i know nothing of it.

also: lolcode and Brainstorm (sorry about the language, but thats its actual name :P )

Posted

scheme....that's based off lisp, isnt it?

i've heard of haskell, but never even looked into it, so i know nothing of it.

also: lolcode and Brainstorm (sorry about the language, but thats its actual name :P )

aye Scheme/Lisp are very similar, and those two mock-languages are awesome :D99 Bottles of beer showcases what code looks like in different languages, eg perl :D

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...