.net

How to check if I can create a file in a specific folder in c#?

I need to know if I can create a file in a specific folder, but there are too many things to check such as permissions, duplicate files, etc. I'm looking for something like File.CanCreate(@"C:\myfolder\myfile.aaa"), but haven't found such a method. The only thing I thought is to try to create a dummy file and check for exceptions but th...

Why are ASP.NET pages so much slower on localhost than on the production server

The title pretty much sums it up, and I'm sure there's a perfectly valid explanation, but it seems extremly odd that loading pages(after they're compiled) on my local computer seems to take forever, when the same code is blistering fast when "live". I'm developing on Vista, IIS7, pretty ok hardware; while the server is a single machine,...

Changing an assembly's manifest without re-building

In .NET, is there a tool or some other method which would allow us to modify an assembly's manifest, without having to modify the AssemblyInfo and re-build the assembly? Thanks ...

Threaded loading (waiting) screen

I'm looking for a generic method to implement a wait screen during long operations. I have used threading a few times before, but I have the feeling that I implemented it either very poorly, or with way too much hassle (and copy/pasting - the horror!). I want to keep this as generic and simple as possible, so I won't have to implement l...

Efficient Way To Query Nested Data

I have need to select a number of 'master' rows from a table, also returning for each result a number of detail rows from another table. What is a good way of achieving this without multiple queries (one for the master rows and one per result to get the detail rows). For example, with a database structure like below: MasterTable: -...

What's better for DSL: TCL or Lisp?

What's better for DSL: TCL or Lisp? What can you say about Java(C#)-TCL binding versus Lisp(Scheme)? What DSL tool is applicable for .Net development? (excepting Microsoft DSL tools) ...

Can I use Extension Methods to implement an Interface ?

I would like a class to implement an interface, I do not want to change the original class (that would add undesired dependecies). I know I could inherit from the class and make it's child implement these methods, but then I am faced with a problem how to convert the parent class (that come from the data / ORM) to this presentation clas...

How to convert from Parent to Child ?

I have a class in my domain model called JobPlan this class is stored / retrieved via ORM and used on various places. I am creating a view that shows a treelist of this class and the treelist needs this class to implement certain interface (the interface comes from a 3rd party lib). Adding the interface to the JobPlan class will ho...

Comparing .Net Version instance using CompareTo does not work as expected.

The Version class in .Net does not implement the CompareTo interface as I would expect, it seems to handle the compare alphanumerically instead of comparing the four numbers. Maybe not a bug, but a 'feature'. Can anyone shine a light on why the compare (and also the standard <, = and > operators) do not work as I would expect below? ...

Determine the source DataContext for a Linq to Sql query

In my application I have several DataContexts that connects to different databases with different schemas. In a custom user control I display the results of the query and let the user edit them, and when the user edits the data I want to persist the changes to the database. To do that I need a reference to the source DataContext (or at l...

What is the best way to build up an XML document in .NET?

There seem to be many options to create an XML document in .NET. What's the best approach? ...

C++/CLI Books

Can anyone recommend any specific books on C++/CLI, particularly with reference to .NET and Visual Studio. It seems to me that there is very little out there, a few APress books with a couple of comments each on amazon. I'm looking in particular for something that isn't an introduction to C++, but something more Microsoft specific. Than...

Printing from the web at client side

How can we print using print document so that we can control the printer paper size? It must be controlled after web hosting is done without the print dialog popup or javascript popup. It should print on the client's printer after webhosting without the print dialog option and setting the paper size. It should be done in C# .net ...

IPC between .NET and Java client applications

Dear all, I must get two different client application talk without any kind of broker or server. What is the best method for IPC beween two process, Java and .NET? It must able to be work in multi-user termainl server, so no socket please. I wish that it is lightweight and simple, something plug and run, so no RMI/WS please. I'm now t...

Do i need to dispose of this Image instance?

Hi folks, I'm making a simple Image Debugger Visualizer. Code is below. I'm not sure if i need to manually dispose of the Image instance? Because i'm making a windows Form window and the PictureBox inside that contains my dynamic image .. do i need to add some special code when the form is terminating, to dispose of this? here's the...

Is yield useful outside of LINQ?

When ever I think I can use the yield keyword, I take a step back and look at how it will impact my project. I always end up returning a collection instead of yeilding because I feel the overhead of maintaining the state of the yeilding method doesn't buy me much. In almost all cases where I am returning a collection I feel that 90% of t...

Silverlight: is there a way to allow a user to open a file from isolated storage?

Hi all, I'd like to allow a user to open files in their own client applications via Silverlight. I'd like this to work similarly to WebDAV, in the sense that they could read/write the file back into Silverlight's isolated storage... Is it possible to construct a file:// link to an isolated storage file? Is there a uri scheme that is def...

C#: Ask User for a Password which is then stored in a SecureString

In the small application that I'm currently developing for a customer I need to ask the user for his windows login username, password and domain and then use those with System.Diagnostics.Process.Start to start an application. I have a textbox with UseSystemPasswordChar to mask the entered password. I need a System.Security.SecureStri...

Why does Visual Studio stall while debugging?

Sometimes, while I am debugging a c# application, I will hit a break point and when I try to continue, step or step into, it just does nothing. The yellow line highlighting the current line goes away, but it never reaches the next line. The app is still frozen like I am on a breakpoint and I can do nothing but hit the stop debugging bu...

Why is the indexer on my .NET component not always accessible from VBScript?

I have a .NET assembly which I am accessing from VBScript (classic ASP) via COM interop. One class has an indexer (a.k.a. default property) which I got working from VBScript by adding the following attribute to the indexer: [DispId(0)]. It works in most cases, but not when accessing the class as a member of another object. How can I get...