.net

Why can you assign Nothing to an Integer in VB.NET?

Why am I allowed to say: Dim x as Integer x = Nothing in VB.NET, but I can't say: int x; x = null; in C# ? ...

Horizontally Flip a One Bit Bitmap Line

I'm looking for an algorithm to flip a 1 Bit Bitmap line horizontally. Remember these lines are DWORD aligned! I'm currently unencoding an RLE stream to an 8 bit-per-pixel buffer, then re-encoding to a 1 bit line, however, I would like to try and keep it all in the 1 bit space in an effort to increase its speed. Profiling indicates th...

.NET Process.Kill() in a safe way

I'm controlling a creaky old FORTRAN simulator from a VB.NET GUI, using redirected I/O to communicate with the simulator executable. The GUI pops up a "status" window with a progress bar, estimated time, and a "STOP" button (Button_Stop). Now, I want the Button_Stop to terminate the simulator process immediately. The obvious way to do t...

Multithreaded Delegates/Events

I am trying to disable parts of the UI in a .NET app based on polling done on a background thread. The background thread checks to see if the global database connection the app uses is still open and operable. What I need to do, and would prefer to do it without polling on the UI thread, is to add an event handler that can be raised by...

FluentNHibernate: multiple one-to-many relationships between the same entities.

Hi, I'm working on a bug tracking application. There are tickets, and each ticket has an opener user and an assigned user. So, basically, I have two entities, which have two many-to-one relationships with each other. Their schematic is this: User: public class User { public virtual int Id { get; protected set; } ... publi...

Creating a ListView/TreeView using Category (Control Panel-Like) View

I currently have an application which uses a regular ListView with groups to show a bunch of modules. I would like to use a Category view. Category view is the new view introduced in Windows Vista for the Control Panel: Is there a third party control or a way (via API) to create a ListView which mimics the behavior of the Windows 7 C...

C# equivalent of typeof for fields

With reflection, you can look up a class from a string at run time, but you can also say typeof(Foo) and get compile time type checking, auto completion etc. If what you want is a field not a class, you can look it up from a string at runtime, but if you want compile time type checking etc., is there anyway to say something like fieldof...

How to maximize http.sys file upload performance

I'm building a tool that transfers very large streaming data sets (possibly on the order of terabytes in a single stream; routinely in the tens of gigabytes) from one server to another. The client portion of the tool will read blocks from the source disk, and send them over the network. The server side will read these blocks off the ne...

Problem while Building a Setup Project for a windows Service?

Hi guys, I have created windows service project in vs2008. I have created simple serivce project and implemented simple serivce sucessfully. Unlike other application i cannot run service exe file, so I had to first installed service using ServiceInstaller in my service project. Now i am building setup project for my service (MSI). In ...

Lambda expressions as CLR (.NET) delegates / event handlers in Visual C++ 2010

Is it possible to use the new lambda expressions in Visual C++ 2010 as CLR event handlers? I've tried the following code: SomeEvent += gcnew EventHandler( [] (Object^ sender, EventArgs^ e) { // code here } ); It results in the following error message: error C3364: 'System::EventHandler' : invalid argument for deleg...

why does entity framework+mysql provider enumeration returns partial results with no exceptions

I'm trying to make sense of a situation I have using entity framework on .net 3.5 sp1 + MySQL 6.1.2.0 as the provider. It involves the following code: Response.Write("Products: " + plist.Count() + "<br />"); var total = 0; foreach (var p in plist) { //... some actions total++; //... other actions } Response.Write("Total Products Che...

How do I know an array of structures was allocated in the Large Object Heap (LOH) in .NET?

After some experimenation using CLR Profiler, I found that: Node[,] n = new Node[100,23]; //'84,028 bytes, is not placed in LOH Node[,] n = new Node[100,24]; //'86,428 bytes, is public struct Node { public int Value; public Point Point; public Color Color; public bool Handled; public Object ...

Help with string manipulation function

I have a set of strings that contain within them one or more question marks delimited by a comma, a comma plus one or more spaces, or potentially both. So these strings are all possible: BOB AND ? BOB AND ?,?,?,?,? BOB AND ?, ?, ? ,? BOB AND ?,? , ?,? ?, ? ,? AND BOB I need to replace the question marks with @P#, so ...

Demo application on Windows Azure Platform?

I need a demo application to demonstrate about Windows Azure Platform. I tried myTODO project , but because it's not updated since Aug/2009, it cannot work properly (even after installing and configuring all needed components) . Very appreciated if you can suggest me an open-source, free project build for Windows Azure Platform, which ...

C# File.ReadAllLines not breaking on line feeds

Hello, I have an application that I am building that needs to modify a configuration file. My problem is that I am not able to read the file in line by line. I keep geeting the the entire file as a single string. string ConfigTemplate = AEBuildsSPFolderName + "\Template_BuildReleaseScript.Config"; string[] fileSourceLines = File.Rea...

Referencing assemblies created with ILMerge in Visual Studio projects

I have a solution in Visual Studio with 5 projects. They are: Foo.Core: Core functionality Foo.Api: Generated code built on top of core Foo.Web: Web-specific extensions Foo.Web.Mvc: MVC-specific extensions Newtonsoft.Json: 3rd party library I want to use ILMerge to merge Foo.Core, Foo.Api and Newtonsoft.Json into a single assembly, c...

Visual Studio 2010, targetting the 4.0 framework for debug and the 4.0 Client Profile for release.

I have been unable to edit and continue in a project that targets the 4.0 Client Profile however i can if i am targetting the full 4.0 Framework. I want to release against the client profile to limit the download required to install. Is there anyway i can build against the client profile but debug agains the full version? ...

How to get the reference of latest version of MS Excel in VB.net application?

I am using Excel Interop in my VB.net application. I am using Microsoft Office 11.0 Object Library and Microsoft.Office.Interop.Excel for excel automation. Both the dlls are for Office 2003. My question is, how can I get my project to refer to the latest version of MS Office( say Office 2010) ...

Good IOC Frameworks to use with asp.net mvc?

Hi I am wondering what good simple IoC frameworks are there for asp.net mvc? that have good documentation and are just easy to get up and going. Thanks ...

Can I use C++/CLI (.NET Winforms/WPF ) to provide GUI for app written in native C & C++

Hello, I've an app written C & C++. Now, I need to provide a GUI for this app. MFC is the best option for me. But I'm not familiar with MFC. So can I use .NET to build GUI for this? If so, How? Please be clear. If I can use .NET I guess I can use WPF too right? ...