.net

Sharing service interfaces and model in Silverlight, using WCF

Say I have the following interface that I want to share between my server (a regular web service) and my client (a silverlight 2.0 application): public interface ICustomerService { Customer GetCustomer(string name); } My web service implements this interface, and references a class library where Customer type is defined. Usually,...

Is it safe and acceptable to install VS.NET on your production server?

Usually, we install VS.NET on our production server, to solve problems easily with our product, if necessary. Is this a good or bad idea? ...

What is the easiest way to parallelize my C# program across multiple PCs

I have many unused computers at home. What would be the easiest way for me to utilize them to parallelize my C# program with little or no code changes? The task I'm trying to do involves looping through lots of english sentences, the dataset can be easily broken into smaller chunks, processed in different machines concurrently. ...

Why does C# Multidimensional arrays not implement IEnumerable<T> ?

I have just noticed that a multidimensional array in C#, does not implement IEnumerable<T>, while it does implement IEnumerable. For single-dimensional arrays, both IEnumerable<T> and IEnumerable is implemented. Why this difference ? If a multi-dimensional array is IEnumerable, surely it should also implement the generic version ? I no...

What applications could I study to understand (Data)Model-View-ViewModel?

I understand the basics of the Model-View-ViewModel pattern or as Dan Crevier calls it the DataModel-View-ViewModel pattern and I understand that it is a good approach to design WPF based applications. But there are still some open question. For example: Where do I put my business logic where my validation logic? How do I decouple the ...

Trouble adding an assembly reference to a project.

I'm having a problem adding a reference to a .NET assembly I built. Here's what I did. I created a .NET assembly (testlib.dll). I made sure it had a strong name (added a keyfile). I creates a WiX installation project for that assembly. I added Assembly='.net' and KeyPath='yes' to the File property for the assembly. The installation w...

Is it possible to change the RESX generator to use public accessor on generated class?

I'm writing an ASP.NET MVC application and trying to use a RESX file to store error messages and other common strings. The problem is that the RESX generator builds internal classes and it's not possible to use them in the ASP.NET HTML code using a syntax like: <%= Resources.SomeString %> Is it possible to tweak a setting to get the ...

Where is .NET "Isolated Storage" stored?

Where would the physical files be? ...

Does WCF optimize the client's connection under the hood?

We are currently working on an application that will use a WCF service. The host (the client) is using the excellent WCF Service Proxy Helper from Erwyn van der Meer. What I would like to know... is if I open this object multiple times... will it lead to multiple (expensive) connections or will WCF manage it and pool the connections. T...

How to programatically upload/post an image to an image hosting website without a browser?

I want to write a simple utility to upload images to various free image hosting websites like TinyPic or Imageshack via a right-click context menu for the file. How can I do this using .NET? I've seen some linux scripts that use cURL to post images to these website but I'm not sure how I could create the post request, complete with an ...

How to get relative path from absolute path

There's a part in my apps that display the file path loaded by the user through OpenFileDialog. It's taking up too much space to display the whole path, but I don't want to display only the filename as it might be ambiguous. So I would prefer to show the file path relative to the assembly/exe directory. For example, the assembly resides...

Which .NET framework version will be included in Windows 7?

Does anybody know if Microsoft has already decided which version of the .NET framework will be shipped in Windows 7 next year (2009)? Will it .NET 3.5 (SP 1) or maybe 4.0? ...

Best way to compare 2 XML documents in .NET

I have a heap of unit tests that need to check XML outputs. I have started out comparing strings but this isn't going to scale as formatting and superficial differences get in the way. What is the easiest way in .NET to evaluate whether the generated XML is semantically the same as what the test expects? Closed as duplicate of How...

Multiple colors in a C# .NET label

Hi, I'm looking for a way to display multiple colors in a single C#/.NET label. E.g the label is displaying a series of csv separated values that each take on a color depending on a bucket they fall into. I would prefer not to use multiple labels, as the values are variable length and I don't want to play with dynamic layouts. Is the...

How to determine the attached type from within a custom attribute?

I have a custom attribute which can be assigned to a class, [FooAttribute]. What I would like to do, from within the attribute, is determine which type has actually used me. e.g. If I have: [FooAttribute] public class Bar { } In the code for FooAttribute, how can I determine it was Bar class that added me? I'm not specifically looking...

Can I write an app in the new version of Visual Studio and make it compatible with .NET Framework 1.1

I am a Web developer who spends 99% of his time in Linux, but I need to develop a super simple application with VB or possibly C# (.Net). The only version of Visual Studio I have is the most current free ones. There MIGHT be a copy of 2001 lying around somewhere. Anyways, the machine I need to develop this for is running Windows NT4. ...

WCF over HTTPS with PHP throws "Method Not Allowed" exception

I've created a .NET WCF service that is intended to always be over HTTPS. When I first created the service skeleton and ran it over HTTP, it worked fine. I used PHP5 to test the interoperability with the built in SOAP functions. However, once I switched to HTTPS, when I try to call the function from PHP, I get a fault back with the messa...

Do you think it's advantageous to switch to Entity Framework?

With LINQ to SQL most likely going to not get as much active development as Entity Framework do you think it's best to switch to Entity Framework? I've personally found EF to be very clunky and hard to use compared to LINQ to SQL which feels very natural. EDIT: I recently posted an article on my blog about my feelings towards this pote...

Connecting to DB2 via .NET DbConnection

Our current DB Connection provider model relies on database connectivity to use DbConnection (System.Data) based objects. We can connect to DB2 (*Nix * Windows) via OdbcConnection, but we would like to allow the use of native DB2 Drivers. Is there any way to do so (either .Net framework, OpenSource or (last choice) vendor) without bre...

Get object's DataContext

If I have the LINQ objects: public class SampleDataContext : DataContext { public Table<Customer> Customers { get { return this.GetTable<Customer>(); } } public SampleDataContext( string connectionString ) : base( connectionString ) { } } [Table( Name="dbo.tblCustomers" )] public class Customer { private Guid? customerID; ...