.net

Is it expensive to create objects in .Net?

I have just refactored a colleague's code that, roughly, looked like this... public class Utility public void AddHistoryEntry(int userID, HistoryType Historytype, int companyID) { // Do something... } public void AddHistoryEntry(int userID, HistoryType historyType, int companyID, string notes) { // Do something... } ...

Why Is ToString() Rounding My Double Value?

How do I prevent my double value from being rounded when converting to a string? I have tried both Convert.ToString and ToString() with the same result. For example my double may look something like 77.987654321, and the two strings conversions convert to to 77.98765. I need to keep the precision of the value as is. ...

LINQ group by month question

I'm new to LINQ to SQL and I would like to know how to achieve something like this in LINQ: Month Hires Terminations Jan 5 7 Feb 8 8 Marc 8 5 I've got this so far, and I think there is something wrong with it but I'm not sure: from term1 in HRSystemDB.Terminations ...

Tree Collection in .NET

When I make a list box in WPF I frequently set its ItemsSource to be a List. Is there a Tree for TreeView (or what goes in ItemsSource for TreeView)? Is there a collection or generally accepted method for handling tree data in C#.NET? ...

C# - Entity Framework - Understanding some basics

Model #1 - This model sits in a database on our Dev Server. Model #2 - This model sits in a database on our Prod Server and is updated each day by automatic feeds. I have written what should be some simple code to sync my feed (Model #2) into my working DB (Model #1). Please note this is prototype code and the models may not be as...

What is the easiest way to update a .NET Windows service in production?

Say, you have a custom Windows service installed on a server. The service is written using .NET, and it is installed using either InstallUtil, an MSI package or the ManagedInstallerClass (if it makes a difference, pick the one that solves the problem). Regularly, you will need to deploy changes to the service, and of course you want to m...

What is the feature you like best in ASP.Net MVC 2.0?

ASP.Net MVC 2.0 will be released in a few months. There are some bug fixed and some new features. Which feature is more useful for you and you will use more? ...

From a UITypeEditor, retreive an attribute applied to the parent of a property in .net

It's not quite as simple as the title says but I hope you understand. Consider this scenario: Class MyClass Property SubProp1 End Property -TypeEditor(whatever)- Property SubProp2 End Property End Class Class MyButton Inherits Button -MyCustomAttribute- Property MC as MyClass End Property End ...

WPF advice on XML data binding: XmlDataPresenter vs custom class?

Hello there, I'm just starting out in WPF and I'm building a simple movie library as a test project to help me find my feet. I'm storing my movie information in XML, for example: <movie id="1" title="Back To The Future" date="1985" ... /> The movies appear in a list and when clicked the fields will become editable. I've got that w...

Threading issues using Ping to map active IPs - C#

I am trying to create a simple Network Tool to ping all possible IPs on your local subnet and provide a list of such IPs in a DataGridView. I am new to having to consider threading which is a good thing to come across as a budding programmer. Sorry, but you are probably going to have to do some explaining to me, but in my mind this sho...

.net way to split odd and even pipe-delimeted data

I have a bunch of data in pipe-delimited format, where odd entries are index numbers, and even entries are the data e.g. 1|cat|2|dog|3|manatee|4||5|gerbil|6|etc (note occasional missing values) and I'm wondering if there is a nice .NET type way of turning this into a class pet with id and name parameters. I've got some code which do...

what I am missing on this machine when I got this warning?

This machine only have SDK and .Net3.5 installed. No VS2008 installed. after this warning, C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKe...

Fluent nHibernate

I am having a bit of trouble figuring out how to make a specific design in fluent nHibernate. I have a small workflow prototype with two aspects to it. First, you can design a workflow, that has a collection of 'phases' and a phase has a collection of 'Tasks'. I have this part loading and saving using nHibernate. Second part, these wor...

VB.net Splash screen not updating

I made a splash screen and want to have some text change on it as different parts of the program are loaded but the screen isnt updating when i use refresh or update. Dim splash As New BMSSplash splash.Show() splash.lblStatus.Text = "Retrieving active users..." splash.Refresh() buddyList.setuserList() System.Th...

Delegate variables not garbage collected

Recently discovered that the variables inside ToGadget, and presumably the delegate as well, weren't getting garbage collected. Can anyone see why .NET holds a reference to this? Seems that the delegate and all would be marked for garbage collection after Foo ends. Literally saw *B*illions in memory after dumping the heap. Note: 'res...

Target .NET 3.5 C++/CLI in Visual Studio 2010 Beta 2

Has anyone had any success converting a VS 2008 C++/CLI (vcproj) project to a VS 2010 project (vcxproj), whilst maintaining .NET 3.5 as the target framework? I haven't been able to do this and get the project to build successfully. The project compiles fine in VS2008 as .NET 3.5, and fine in VS2010 as .NET 4.0, but I am unable to target ...

Can I add a common function to a set of EntitySet<TEntity> Classes - LINQ to SQL

I am using LINQ to SQL and want to add functions to autogenerated EntitySet< TEntity > collections. eg. City.Houses where Houses is automatically generated EntitySet < House > I am using extension method to add extract function to the EntitySet < House > class so that I can get something like City.House.FindByID(id); but now I ...

UI Threading with ViewModels

Collections that are bound in a WPF View must be updated on the UI thread. ViewModel exposes a collection Therefore when collection in the ViewModel is modified it must be done in the UI thread Best practice is to keep ViewModels ignorant of View and presumably such details as Dispatcher. What is the cleanest way to resolve this whil...

Logging errors via HTTP - security implications

I am writing an application in which application errors are logged and posted to a listening HTTP port on our server. We decided against email since many of the clients running the server "would not be able to send anything through SMTP" (according to boss dude) I was just going to send the data as-is using log4net and a custom-written ...

Problems converting crystal reports from vb6 standalone app to .net web app

I have been asked to convert a legacy app containing some crystal reports from vb6 standalone to .net c# web based application This is my first .net c# web app so I am learning as I go My attempts to get crystal reports .net (included version not licensed) have failed. I was pleasantly surprised to find that I could simply copy the ....