|
public static IEnumerable<IList<T>> Split<T>(this IEnumerable<T> collection,T delim,IEqualityComparer<T> equalityComparer = null)
public static IEnumerable<T> Join<T>(this IEnumerable<IList<T>> segments, IEnumerable<T> delim)
public static IEnumerable<T> Replace<T>(this IEnumerable<T> collection,T oldValue, IEnumerable<T> newValues, IEqualityComparer<T> equalityComparer = null)
Guess I could use LINQ but nah.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
A small consolation maybe, you can use aliases like this:
using MyDictionary = Dictionary<string, List<int>>;
|
|
|
|
|
You can't do like
using MyDict<TValue>=IDictionary<string,TValue>;
so it's of little help to me in this. I really wish .NET had something as flexible as C++'s typedef
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
|
If only because I have built this code up over years, I'm sticking with C# (there's a lot more than this)
I just think this one's funny because it's Split/Join/Replace like for System.String but with collections. I actually *needed* that.
Parser construction is weird.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Use the tools you've been given.
# define MyDict(x) System.Collections.Generic.IDictionary<string,x>
namespace Smartassery
{
public static partial class Supreme
{
public static void
Main
(
)
{
System.Console.WriteLine ( typeof ( MyDict(int) ) ) ;
return ;
}
}
}
cl.exe /C /EP /P MyDictTest.cs
csc.exe MyDictTest.i
|
|
|
|
|
now that's just hateful.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
I fail to see the problem...
var myList = new List<SOMETHING>();
var aValue = GetSplitValue();
var result = myList.Join(otherlist).Split(aValue).ToList();
What's wrong with that?
|
|
|
|
|
the fact that i had to write those
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
ha.. no biggie!
err... I feel so sorry with you!
|
|
|
|
|
I feel quite weary as well, look what I had to write myself too!
Sigh, such burden...
public static IEnumerable<T> Enumerate<T>(this T item, Func<T, T> getNext)
{
while (item != null)
{
yield return item;
item = getNext(item);
}
}
|
|
|
|
|
If you have something serious to say, why not start a thread in the C# language forum.
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
|
|
|
|
|
If not, the Lounge will do fine.
Seriously, I prefer these harmless rants over a lot of the other crap we get in the forums.
|
|
|
|
|
agree… upvoted
|
|
|
|
|
codewitch honey crisis wrote: Guess I could use LINQ but nah.
Anything serious you wanna inform us about?
Rules for the FOSW ![ ^]
if(!string.IsNullOrWhiteSpace(_signature))
{
MessageBox.Show("This is my signature: " + Environment.NewLine + _signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
not especially
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
Serious? This is The Lounge. We don't do "serious" here.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Assuming the OP has something on their mind of a technical nature in posting, I call that serious, and I think the topic (assuming the OP intends to do more than strike poses) just might lead to a fruitful discussion in the C# language forum ... which, once upon a time, was not just another QA for endless series of questions by newbs, and desperadoes who need their feet pulled out of the fire
Of course, for me, the C# forum is often redeemed by the quality of responses by you, OG, MacCutchan, Patyn, Hillier, Vluggen, SuperLloyd, and (alas too rarely, these days) O'Hanlon, Clifton
«Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot
modified 17-May-19 8:25am.
|
|
|
|
|
Nope. No technical questions. It wasn't a question at all. Just a goofy look at the sort of code i end up writing in imperative languages. Like Split/Join/Replace that operates on collections.
When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.
|
|
|
|
|
You are right
Rules for the FOSW ![ ^]
if(!string.IsNullOrWhiteSpace(_signature))
{
MessageBox.Show("This is my signature: " + Environment.NewLine + _signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
Exactly.
Latest Article - A 4-Stack rPI Cluster with WiFi-Ethernet Bridging
Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny
Artificial intelligence is the only remedy for natural stupidity. - CDP1802
|
|
|
|
|
Any CPians who collect 1:43 scale Dinky and Corgi models?
/ravi
|
|
|
|
|
No. Why buy toy cars when you can have a real one?
Speaking of Dinky, this ugly thing[^] keeps popping up when I recently was looking for good pictures of the original studio models.
I have lived with several Zen masters - all of them were cats.
His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
|
|
|
|
|
No, but I understand the Queen used to collect Dinky Corgis.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I used to collect diecast cars. I have about 500 (most are 1/64, but have soem 1/43, 1/32, 1/24, and 1/18. Most are NASCAR, but I also have some 50's-60's Le Mans cars, a couple of 60's Grand Prix cars, and a handful of Trans Am cars.
All of them are displayed in a re-purposed entertainment center that my dad and I added lights, glass shelves, and sliding glass doors to.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|