Junior Spellweaver
- Joined
- Sep 23, 2012
- Messages
- 129
- Reaction score
- 17
Good Luck
Last edited:
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
Good Luck
Why not use an array?
Lol anyway I would really to see this go somewhere and not die off..
ps ? is C# your first programming lang ? and how did you pick it up ?
I don't see the OP showing off at all, infact this is opensource aswell.why do people make these threads to show off, especially v111 man you are like 40 versions behind
i store inventory items by creating a dictionary with the size of the inventory max slots, leaving empty slots with null value. it's pretty gay but this is c# so it's ok right
I can't tell if this is troll or serious.
Dictionaries are dynamic, why on earth would you do that!?
why do people make these threads to show off, especially v111 man you are like 40 versions behind
public static T FindOne<T>(this IEnumerable<T> sequence, Func<T, bool> predicate){
foreach (T item in sequence)
{
if (predicate(item)) //returned true
return item;
}
return default(T);
}
public static T FindOne<T>(this IEnumerable<T> sequence, Func<T, bool> predicate){
return sequence.Single(predicate);
}
I would advice using LINQ more though,
For example, you now have this
Code:public static T FindOne<T>(this IEnumerable<T> sequence, Func<T, bool> predicate){ foreach (T item in sequence) { if (predicate(item)) //returned true return item; } return default(T); }
Why not simply use this
Code:public static T FindOne<T>(this IEnumerable<T> sequence, Func<T, bool> predicate){ return sequence.Single(predicate); }
Or simply dont even bother writing a function for it and directly call Single() or Where()