c#-4.0

Multithreaded File Compare Performance

时光毁灭记忆、已成空白 提交于 2020-01-07 02:37:34
问题 I just stumbled onto this SO question and was wondering if there would be any performance improvement if: The file was compared in blocks no larger than the hard disk sector size (1/2KB, 2KB, or 4KB) AND the comparison was done multithreaded (or maybe even with the .NET 4 parallel stuff) I imagine there being 2 threads: one that reads from the beginning of the file and another that reads from the end until they meet in the middle. I understand in this situation the disk IO is going to be the

Getting form values with MvcPager

做~自己de王妃 提交于 2020-01-07 02:37:09
问题 When I select any page of my PagedList<T> the [HttpGet] method is activated. Because of this, Im not able to use Request.Form.GetValues() . I just saw the Request variable into the immediate window and realized that I dont see any value that I want from the IDs that I have ( the request dont bring me any value of any ID of the screen, since Im not using the post method). I got a grid (table) and one field of each record is a checkbox, after the pagination, I need know wich checkbox is enabled

Gridview - convert textboxcell to comboboxcell and back

狂风中的少年 提交于 2020-01-07 02:35:28
问题 I have a question about datagridviewcell. i have created textboxcolumn in datagridview. when ever i click the particular cell the cell should change to datagridviewcomboboxcell. Also i need to add the item in combobox collection. when i go to another cell then, the new cell get datagridviewcombobox cell and existing cell should change to datagridviewtextbox cell... 回答1: You could change the DataGridViewTextBoxCell to DataGridViewComboBoxCell in the CellBeginEdit event and change it back in

how to re-sizing pdf content with iTextsharp

天大地大妈咪最大 提交于 2020-01-07 02:33:05
问题 I just need to resize page content in a pdf file, it's not related to Reducing file size I just need to reduce each page content which is one image to be able to print it as a booklet in landscape mode. So I need to reduce the height and the width of each page content. I'm using iTextSharp with c# 回答1: The easiest way might be to change the size of default user space units for the pages in question. The default user space units can be configured on a per-page basisusing the page dictionary

.NET Regex - Find text between two characters within a single or multiple line block of text

别等时光非礼了梦想. 提交于 2020-01-06 20:19:57
问题 I have been monkeying with the following regex expression: (\b\*)\w+(\*\b) What I wanted to do was extract ^vitae^ from Nam vestibulum hendrerit justo. Quisque ^vitae^ libero magna. Curabitur pretium eros ut augue ullamcorper feugiat. Aenean blandit libero vitae nunc sodales pharetra. But what I seem to get is that regex found the text in question and returns the all of the text in the sentence as opposed to just ^vitae^ Any help would be greatly appreciated Thanks! 回答1: To match any text

Since Modified Header in c#

主宰稳场 提交于 2020-01-06 19:48:51
问题 Am saving Webpages from webbrowser control to the directory like below code. Now i want to check all the webpages daily that is modified or not. if it is modified have to update or else leave it. here i tried something in console application. static void Main(string[] args) { Uri myUri = new Uri("http://www.google.com"); // Create a new 'HttpWebRequest' object with the above 'Uri' object. HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(myUri); // Create a new 'DateTime'

Element already child of other element error in Silverlight User Control

会有一股神秘感。 提交于 2020-01-06 19:44:15
问题 I've placed some UIElements in a row of the grid at different column positions, now I have a + button if I click on that a new row containing same UIElements should be added below the first row. but it gives me error like "Element is already child of other element". How can i get rid of this error. I need to add an duplicate copy(new reference) of the control below it in the new row. how can i do it? Any help would be appreciated.... Thanks, Gk Prajapati 来源: https://stackoverflow.com

and operator in Linq and select distinct values using linq

雨燕双飞 提交于 2020-01-06 19:37:14
问题 I am new to .net. I have a form in which there are two comboboxes cbProduct and cbBrandName and also a label lblPrice . I am trying to implement the below code but it is showing blue scribbles to && . (Error: operator '&&' cannot be applied to operands of type 'lambda expression' and 'lambda expression' ) I tried the below code: ( not working ) lblPrice.Text = string.Empty; lblPrice.Text = doc.Descendants("items" ).Where((x => x.Element("productname" ).Value.Equals(cbProduct.SelectedItem

Send Private message with LinqToTwitter

风流意气都作罢 提交于 2020-01-06 17:39:13
问题 Hi i want to send private message with linqToTwitter, here is my code : var auth = new MvcAuthorizer { Credentials = new InMemoryCredentials() { ConsumerKey = TwitterClient.ConsumerKey, ConsumerSecret = TwitterClient.ConsumerSecret, OAuthToken = TempData["AccessToken"] as string, AccessToken = TempData["TokenSecret"] as string } }; var twitterContext = new TwitterContext(auth); var message = twitterContext.NewDirectMessage(auth.UserId, "Hi ucef, cool to discuss with you" + DateTime.Now); but

Detect Universal App at Runtime in PCL

旧时模样 提交于 2020-01-06 16:53:13
问题 Is there any way to detect that a main application is a Universal App (W10) from a Portable Class Library? Thanks 回答1: Out-of-the-box I do not think the functionality you are asking for is available in PCL, but here is a suggestion involving reflection that you might want to try. It is adapted to the PCL Profile (328) you are using, involving .NET 4 and Silverlight 5. The GetPlatformName method needs to be somewhat adjusted if you want to for example switch to PCL profiles 111 and 259, since