.net

ADO.NET Data Services - format parameter - xml / json

Has the $format parameter been removed with the VS2008 SP1 release of ADO.NET Data Services. I try to use it and I get the error: The query parameter '$format' begins with a system-reserved '$' character but is not recognized. I think the support for the Atom stuff is very cool, but can you get "plain old xml" too? ...

Debugging successful but service not working after installation.

I used the following piece of code in the service to debug the service successfully by running the service as a console application and verified everything works fine.But later when I installed the service and started it as a windows application the service is running as indicated by the services console but it is not doing the job it ha...

ObjectContext memory consumption and performance

I want to write a business object layer in a way that makes each entity object responsible for saving its own changes. I thought it would be a good way to have each entity posses its own ObjectContext, attach itself to that ObjectContext and perform the transaction whenever it needs to be saved. In LINQ to SQL, DataContext is very ligh...

Debug.Assert vs Exceptions

Surprisingly I was only able to find one previous question on SO about this subject, and I'd just like to get the community "Vote of Confidence" (or not!) on my approach. The way I see it is thus: use Debug.Assert to state things you EXPECT would be true. This would be used when we are in complete control over our environment, for ex...

How do I serialize an enum value as an int?

I want to serialize my enum-value as an int, but i only get the name. Here is my (sample) class and enum: public class Request { public RequestType request; } public enum RequestType { Booking = 1, Confirmation = 2, PreBooking = 4, PreBookingConfirmation = 5, BookingStatus = 6 } And the code (just to be sure i'm not doing it w...

Thread sleep in a for loop

I need your help for using this method: for (int i =0; i<dt.count; i++) { process... sleep(3000); } int sleeptime=0; private void timer2_Tick(object sender, EventArgs e) { for (int i = 0; i &#60; mylist.Items.Count;) { listBox1.Items.Add(mylist.Items[i].Name.ToString() + "starting..."); sleeptime = int.P...

Set TextBlock to be entirely bold when DataBound in WPF

I have a databound TextBlock control (which is being used inside a DataTemplate to display items in a ListBox) and I want to make all the text in the control bold. I can't seem to find a property in the properties explorer to set the whole text to bold, and all I can find online is the use of the <Bold> tag inside the TextBlock, but I ca...

Convert Dates

Hi, Does anyone know of an easy(built in) way to convert a string like '20081231T130000' (ICalendar I think) to DateTime in C#? Or do I need to parse the string? ...

Update programmatically xml with C#

i try to update xml without linq (i am using VC 2.0). My xml file format: <schedule> <id>0</id> <name>yusuf</name> <status>0</status> </schedule> AFTER UPDATE: <schedule> <id>0</id> <name>yusuf</name> <status>1</status> </schedule> but i do not have any idea update status =0 to status =1 ...

When I change a .NET Button's BackColor back to its original value, it doesn't look the same anymore

I have a button which I wanted to "flash" briefly to get the user's attention. I figured the easiest way would be to change the Button's BackColor property to another color, and then switch it back again. So I do something like this: this.oldColor = myButton.BackColor; myButton.BackColor = Color.Blue; and then after a about 1/2 a seco...

How do strings work when shallow copying something in C#?

Strings are considered reference types yet can act like values. When shallow copying something either manually or with the MemberwiseClone(), how are strings handled? Are they considred separate and isolated from the copy and master? ...

EpiServer CMS 5 R2: Custom Page Providers - The right choice?

Hello, I'm using EpiServer CMS 5R2 on a new project. I've been tasked with creating a CustomPageProvider to link to an existing back end store which we don't have control of. However looking at the sample provider (XmlPageProvider) it appears that the provider is responsible for maintaining the meta information that EpiServer needs for ...

c# DateLastAccessed saved in SQL returned 1millissecond out (less)

When I save a file 'last saved' date time in a SQL database, I cannot compare with a future scan directly - eg if( SavedLastAccessDate <> FileSavedDate I have to do this: DateTime fileSavedDateTime = System.IO.File.getLastWriteTime(filepath); TimeSpan gap = fileSavedDateTime - SavedLastAccessDateTime; if (gap.Milliseconds > ) { do so...

Blurred/Pixellated display of DataTemplate for ComboBox in WPF

I have a DataTemplate giving items for display in both a ListBox and a ComboBox. The window I have created looks like this: The question I have is why the DataTemplate in the ComboBox is blurrier or slightly more pixellated than the display in the ListBox. It is quite difficult to see on the screenshot, but it seems more noticeable whe...

How to implement custom proxy server?

Ultimately, I want to block downloads in .NET WebBrowser control, effectively restricting it to displaying HTML, images, scripts and the like, but never, ever display a "Save as" dialog to the user. The solution proposed in an answer to that question was to hook up a custom proxy server that checks the responses and filters out anything...

Solution for writting a program for keep secret photos.

Solution for writing a program for keep secret photos. I have many secret photos of me and my friends and I don't want anyone to see it for now I just use Winrar and Set password feature and use some encrypt and hide folder software. But I think it isn't enough safe. As I am a C# programmer ,I want to develop an application for ...

Is running a CrystalReport through a .NET application differs from running it using any CrystalReport Designer?

Hi all. I designed a CrystalReport using CrystalReport Designer that embedded with VisulaStudio.NET 2005, while running the report using report viewer, it runs properly and retrieves the required data. While running it throught the application, no data is retrieved?! Is running a CrystalReport through a .NET application differs from ru...

Simulate build provider in ASP.NET Web Application (.Net 2.0)

I am working with .Net 2.0 ASP.NET Web Application. I am programmaticaly creating an assembly containing namespace and classes specified within xml file in the web application. I have created a separate library that does that, I get the assembly and that's fine. But I don't want to reference this as a precompiled component. I want to ...

Tab Page add a new property in C# (winform)

Hi, I need to know how could i add a new property to a tab page. Could you help?? Thanks in advance Maria ...

Checking string format at compile time in C#

In my code there are several strings which are used as keys to access resources. These keys have a specific format, e.g. string key = "ABC123"; Currently, all these keys are stored as strings, but I'd like to make things more robust and type-safe. Ideally, I'd like to check the strings are in the correct format at compile time. The n...