|
C#3
string res = Enumerable
.Repeat("Satish", 100)
.Aggregate((left, right) => left + Environment.NewLine + right);
Console.WriteLine(res);
Do I get a cookie?
|
|
|
|
|
Enumerable maintains an array- am I right?
|
|
|
|
|
nareshss wrote: i have a doubt lie this
You mean a question?
1.
Console.Write(new String('x',100).Replace("x","Satish\r\n"));
2.
Console.Write("ssssssssss".Replace("s","ssssssssss").Replace("s","Satish\r\n"));
3.
public string msg(int cnt) { return "Satish\r\n" + (cnt > 1 ? msg(cnt - 1) : string.Empty); }
Console.Write(msg(100));
Despite everything, the person most likely to be fooling you next is yourself.
modified on Monday, February 25, 2008 8:15 AM
|
|
|
|
|
Guffa wrote: Console.Write("ssssssssss".Replace("s","ssssssssss").Replace("s","Satish\r\n"));
Sheer genius.
Knowledge is hereditary, it will find its way up or down. - Luc Pattyn
so you answer don't be scared of failure
The only failure is never to try
Things You've Never Done - Passenger -2008
|
|
|
|
|
simply superb..
|
|
|
|
|
hi to all!
I m using raw socket class to capture network packets,parsing packet headers of TCP/IP and UDP/IP .I want to determine the packet size .
Is there any method to calculate packet size and also calculating the network traffic rate . anybody have idea to calulate packet size or network trafic rate.
thanks to all.
|
|
|
|
|
Hi friend i m stuck in one problem.
my question is like..
I have added treeview control in my form and also i hav added treenode to this treeview.
that is basically name of all table in my database..
This part i hav done.
Now i want to create a gridview which include all column name of given table name.
Now i want to perform drag and drop operation across treeview.(treenode provide that table name) --(so i want to drag treenode to another panel of my form where i will create gridview dynamically or i can say that from this drag and drop i m able to figure out which table gridview would be created.....)
i have tried all event of treeview but still not able to do this task......?
Hope you understand my problem.
Thanks lot.
Avtar
|
|
|
|
|
You say you have tried all the events on the tree view but no luck?! What have you actually tried?
This all depends on how your application is designed. I'm not really sure from your post exactly what you have tried but here is the overall steps.
1. Set AllowDrop = true for both the treeview and gridview
2. Connect to the treeview drag drop events i.e. so the user can drag an item from the treeview. (plenty of examples on this site)
3. Connect to the grids drag drop events i.e. so the user can drop items into the grid. (plenty of examples on this site)
4. On the grids DragDrop event get the item being dropped i.e. the tree view item.
5. Depending on how your application is designed, populate your grid using the data stored within the dropping node object OR get the data you need from a data set\data source and populate the grid that way. This step all depends on your design.
I cant see any real problems with implementing what you are asking, thats if i have understood what you have asked correctly.
|
|
|
|
|
Thanks lot S_Richie.
Now i m able to do this.
Thanks lot bro.
|
|
|
|
|
Hello, I am not certain that it should be behaving this way but I will explain and hopefully someboday will have some insight/help which would be great.
I will throw together a rough example below, We have a transaction contain multiple saves:
Try
{
Save1.Update(dt.Select(null, null, DataViewRowState.Added));
Save2.Update(dt.Select(null, null, DataViewRowState.Added));
Save3.Update(dt.Select(null, null, DataViewRowState.Added));
}
Catch
{
Trans.Rollback();
}
We have logic in the sprocs to ensure that no invalid data is saved, if Save1 completes the RowState is changed from added to unchanged. However if Save2 then throws an exception the try..catch rolls the transaction back however the Row in Save1 remains with a RowState of unchanged and so that row will not be persisted to the database once the invalid data is corrected and save is called again.
I would have expected the RowState to return to Added if the transaction is rolled back. Has anybody experienced this before? Is this what you would expect?
Thank you for any help or insight, it will be greatly appreciated.
|
|
|
|
|
i m having a datagridview which shows the appointment detail.....user can modify it from another form....so i want to know how can i refresh my datagridview on closing of another form so that it shows the updated record...please help me
|
|
|
|
|
i did the same thing a week or two back, you have to use a dialogResult.
follow my messages in this forum "forms issue" Here[^]
good luck!
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
|
Not a problem
good luck
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
using System.Threading;
Thread myThread = new Thread(new ThreadStart(_listener.Prepare));
myThread.Start(); The Start call on myThread is quite important. Without it, the thread doesn't start, and no amount of debug code in the 'Prepare' method will get called and you look a complete arse when you ask a colleague for help. If you call Start on your thread, your thread starts and everything is really good.
It's gonna be one of those weeks.
Knowledge is hereditary, it will find its way up or down. - Luc Pattyn
so you answer don't be scared of failure
The only failure is never to try
Things You've Never Done - Passenger -2008
|
|
|
|
|
I want to load an assembly from a file, change a method body and save it to a file using reflection. I do not want lot of for loops to traverse through the entire assembly and do all things manually. I just want to change one method in one module in the assembly.
Thanks.
|
|
|
|
|
Sounds nasty.
I think you're going to need a recursive method to do this. Reflection wasn't designed to help you hijack someone else's dll and inject your code into it. That's a scary thought.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for your reply. I can do it really with some iteration or recursion easily- when I know that there is no other way.
I am trying to implement AOP like feature without defining a new class. Some classes do use reflection and my AOP proxy is bypassed in that case. If I could inject some IL at the method beginning it'd be nice. I do not have access to the source but can define which dll is going to be used with the application.
I know its nasty. I really prefer to walk with my girlfriend to write code- but still some people does not like my idea of walking. Joking
Thanks.
|
|
|
|
|
Have a search on this site for the LinFu articles by Philip Laureano. They sound like just the ticket for you.
|
|
|
|
|
Hello Everybody
I am developing an application and i want that when user click on copy button the the content of that of that control get copied and when paste to MS word then it comes as it is on the document.
|
|
|
|
|
Hello,
You may use the Clipboard to copy the data/text and then paste it to your destination.
For example the code below will copy the text in the textbox to the clipboard and then you may paste it to your destination:
//Copy
Clipboard.SetText(this.textBox1.Text);
//Paste
this.textBox2.Text = Clipboard.GetText();
Regards,
Dave
Dave Traister
Software Engineer
ComponentOne LLC
www.ComponentOne.com
|
|
|
|
|
Thanks for solution
Regards
Dikshant
|
|
|
|
|
Please use 'Clipboard', u can use the following relevant functions :-
Clipboard.GetData().
Clipboard.SetDataObject()
etc.
Thanking u.
PalSubrata
|
|
|
|
|
hello everybody
how change axe x in excel graph in c# ?
thanks
jere
|
|
|
|
|
hi,
im doing a project now.In that i used plenty of variables like
datasets,arraylist and other things.It takes lot of memory while using
these objects.eventhough i disposed that objects(using dataset.dispose(),clear(),reset(),similiarly for arraylist and others ) it still not releasing the memory.we tried GC collect also.but unable to solve the
problem
thanx in advance
|
|
|
|