.net

Apply an ICC Color Profile to an image in C# (Dotnet)

How does one convert an image from one color profile to another (screen to printer, or scanner to screen). In Visual C++ you would use the function in ICM.h, is there a managed way to do this with GDI+? I need to use GDI+, not WPF. I'd prefer to have a managed solution, but if it is not available, I guess PInkvoke will have to suffice...

Is there any way to draw an image to use 4 points rather than 3 (perspective warp).

Drawing a parallelgram is nicely supported with Graphics.DrawImage: Bitmap destImage = new Bitmap(srcImage.Width, srcImage.Height); using (Graphics gr = new Graphics.FromImage(destImage)) { Point[] destPts = new Point[] { new PointF(x1, y1), new PointF(x2, y2), new PointF(x4, y4)}; gr.DrawImage(srcImage, destPts); How...

Can you recommend an alternative for NCover?

I'm looking for a good .Net code coverage alternative to NCover (insufficient .Net 3.5 coverage and now pay-for) or VSTS (way too expensive). We currently test with NUnit, but could switch to something with a similar 'layout' for its text fixtures if it were better integrated. ...

Switching from Java to C#

Hi, I am a C/C++/Java programmer and I was wandering if there is any good book or some website that helps you make the switch, I mean, not a beginner's C# book, but a book that compares the platforms, CLI vs. Java Virtual Machine, that explains the .Net arquitecture, etc. To sum up, I already know OOP and design, but I need to learn C#,...

WebClient.DownloadFileAsync fails to raise exception

An odd issue that I have been trying to address in a project - my calls to WebClient.DownloadFileAsync seem to be getting ignored and no exceptions are being raised. So far I have been able to determine this might be due to destination folder not existing, but from the looks of the MSDN documentation for Webclient.DownloadFileAsync this...

How to find out if a file exists in C# / .NET?

I would like to test a string containing a path to a file for existence of that file (something like the -e test in Perl or the os.path.exists() in Python) in C#. ...

Can I stop .NET eating IDs?

I'm an Information Architect and JavaScript developer by trade nowadays, but recently I've been getting back into back-end coding again. And, whilst trying to get an HTML prototype integrated and working with our C#-based CMS, I've come to blows with our programmers over the HTML ID attributes being arbitrarily rewritten by .NET for for...

NUnit - How to test all classes that implement a particular interface

If I have interface IFoo, and have several classes that implement it, what is the best/most elegant/cleverest way to test all those classes against the interface? I'd like to reduce test code duplication, but still 'stay true' to the principles of Unit testing. What would you consider best practice? I'm using NUnit, but I suppose examp...

Very simple C++ DLL that can be called from .net

Hi, I'm trying to call a 3rd party vendor's C DLL from vb.net 2005 and am getting P/Invoke errors. I'm successfully calling other methods but have hit a bottle-neck on one of the more complex. The structures involved are horrendous and in an attempt to simplify the troubleshooting I'd like to create a C++ DLL to replicate the problem....

What is the best way to lock cache in asp.net?

I know in certain circumstances, such as long running processes, it is important to lock ASP.NET cache in order to avoid subsequent requests by another user for that resource from executing the long process again instead of hitting the cache. What is the best way in c# to implement cache locking in ASP.NET? ...

How can I control checkboxes in a .Net Forms.TreeView?

I have a .Net desktop application with a TreeView as one of the UI elements. I want to be able to multi-select that TreeView, only that isn't supported at all. So I'm adding check-boxes to the tree, My problem is that only some items are selectable, and those that aren't can't consistently cascade selections. Is there any way to disa...

How can a .net class library be protected so it cant be referenced by other applications?

How can a .net class library project and resulting dll be protected so it cant be referenced by other applications (.net projects) except those projects in my own solution? ...

Can I use other IDEs other than Visual Studio for coding in .net?

What are the options? How popular are they? Do these IDEs give similar/better functionality compared to visual studio? ...

.NET Scanning API

Is there any free or commercial component written in .NET (no COM interop) that will work with most twain scanners? ...

How to customize Entity Framework classes?

Is there a way to take over the Entity Framework class builder? I want to be able to have my own class builder so i can make some properties to call other methods upon materialization or make the entity classes partial. ...

Where can F# actually save time and money?

There is a lot of hype around the latest functional programming language F# from Microsoft. In real life - where (in what kind of scenarios) can F# most likely save time and money? ...

What's the simplest .NET equivalent of a VB6 control array?

Maybe I just don't know .NET well enough yet, but I have yet to see a satisfactory way to implement this simple VB6 code easily in .NET (assume this code is on a form with N CommandButtons in array Command1() and N TextBoxes in array Text1()): Private Sub Command1_Click(Index As Integer) Text1(Index).Text = Timer End Sub I know i...

Use of .net Assemblies in SQL Server 2005

I've recently discovered that it's possible to place .net assemblies on SQL Server >=2005 servers so that .net functions can be called in T/SQL statements. I wondered what uses people found for these and how they perform? ...

Namespace with Context.Handler and Server.Transfer?

What .NET namespace or class includes both Context.Handler and Server.Transfer? I think one may include both and my hunt on MSDN returned null. Thank you. ...

How do I create a base page in WPF?

I have decided that all my WPF pages need to register a routed event. Rather than include public static readonly RoutedEvent MyEvent= EventManager.RegisterRoutedEvent("MyEvent", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(BasePage)); on every page, I decided to create a base page (named BasePage). I put the above line...