.net

collection/string .Contains vs collection/string.IndexOf

Is there a reason to use .Contains on a string/list instead of .IndexOf? Most code that I would write using .Contains would shortly after need the index of the item and therefore would have to do both statements. But why not both in one? if ((index = blah.IndexOf(something) >= 0) // i know that Contains is true and i also have the ...

WinForms GDI+ Polygon Events and custom shaped panels

I have converted postcode boundary polygons to point data (point[] for each polygon) from GIS Shape Files. I am wanting to show this in a c# windows forms application. I have managed to show this using the System.Drawing (GDI+) DrawPolygon() method. Graphics g = this.CreateGraphics(); Pen pen = new Pen(Color.Black); Brush brush = new ...

silverlight security with WCF service, Forms Authentication and Custom Form Ticket

I have a silverlight application with login on the silverlight page. It uses Forms Authentication with WCF authentication service and customer Membership Provider. Something like : http://blogs.msdn.com/phaniraj/archive/2009/09/10/using-the-ado-net-data-services-silverlight-client-library-in-x-domain-and-out-of-browser-scenarios-ii-form...

How can I reuse .NET resources in multiple executables?

I have an existing application that I'm supposed to take and create a "mini" version of. Both are localized apps and we would like to reuse the resources in the main application as is. So, here's the basic structure of my apps: MainApplication.csproj /Properties/Resources.resx /MainUserControl.xaml (uses strings in Properties/Resour...

Looking for an object database

I'm looking for an object database for .NET that is open source and free for commercial use. I need something that is available as assemblies and/or source code to embed into a project, i.e. not a stand alone database in its own process. I am aware of db4o, and it would be perfect except for the commercial license coming at a price. AC...

How to create Binary Tree in a image(.jpeg)

I have data structured in Binary tree format, i want to represent it into an image(*. jpeg) then i need to display that image on web page and all the data will come @ runtime, so image processing should be done @ runtime, how to do this ? This is what my thought solution any other suitable solution are also welcomed, web site is in .NET ...

How do I change which files by default have build property of content in visual studio.

When adding a PDF, CSV, etc... to a project I have to go to the properties of every file and change the build action to Content. Is there a way to change the list of extensions that are recognized in a project so that this will happen when I include a pdf or csv in my project automatically. Thanks, ...

Is it possible to set a SQL server columns' description using a fluent nhibernate map?

I am using my fluent nhibernate mappings to generate my MS SQL Server database. I would like to be able to set a columns' description as part of this generation. ...

Use of Syntactic Sugar / Built in Functionality

I was busy looking deeper into things like multi-threading and deadlocking etc. The book is aimed at both pseudo-code and C code and I was busy looking at implementations for things such as Mutex locks and Monitors. This brought to mind the following; in C# and in fact .NET we have a lot of syntactic sugar for doing things. For instance...

Microsoft.Practices.ObjectBuilder

I have installed the application on the client's server. Here's the issue though.. The client's server is running on medium trust. With medium trust godaddy does not give persmissions to certain files. If you go to the following URL : http://helpingyougethired.com/Introduction.aspx you will see the error : Could not load file or assembly...

How to Sync a C# Application in-memory object

I have a WCF service to be load balanced with NLB (Windows Network Load Balancer). So I need a Dictionary object to be synced across all the instances of the WCF service. What is the best possible way to do this? ...

DataView.RowFilter Vs DataTable.Select() vs DataTable.Rows.Find()

Considering the code below: Dataview someView = new DataView(sometable) someView.RowFilter = someFilter; if(someView.count > 0) { …. } Quite a number of articles which say Datatable.Select() is better than using DataViews, but these are prior to VS2008. Solved: The Mystery of DataView's Poor Performance with Large Recordsets Array...

Setting WMI permissions remotely on windows server 2003

Hello. I know this question is related to 'server setting' but I can't receive any answer (http://serverfault.com/questions/141754/setting-wmi-permissions-remotely-on-windows-server-2003) this question is close to server setting, but is also very close to programming. if not close please here's the question. I made a simple progra...

does XSLT transformation triggered by a C# code create any dll files ?

I have been facing an error when I trigger XSLT from a C# code, It mentions something about dll file access failure every time, so just want to know whether this transformation code creates any dll files (in C:\Windows\temp directory) as such?? (I have mentioned the error and triggering program in my previous question), ...

Displaying and capturing c# exceptions

I have a c# program which throws a NullReferenceException(). When I start this on my Vista machine, it gives the familiar screen "Foo has stopped working". I can easily click on 'details' to see what went wrong. On one XP machine there's no warning at all: the program just quits, and on another XP I get the "Foo has encountered a problem...

Add objects to association in OnPreInsert, OnPreUpdate

Hi, I have an event listener (for Audit Logs) which needs to append audit log entries to the association of the object: public Company : IAuditable { // Other stuff removed for bravety IAuditLog IAuditable.CreateEntry() { var entry = new CompanyAudit(); this.auditLogs.Add(entry); return entry; } ...

In a web farm environment, should we base the system date/time to the web servers or the database server?

Assuming there are a number of load-balanced web servers in a web farm, is it safe to use the app/web server time in the application code for getting the system date/time or should we leave this responsibility to the database server? Would there be a chance that machine date/time settings on all servers in the webfarm are out of sync? ...

Compare Two DLL's

Scenario I have a C# application compiled as a DLL. I have a build from last week and a build from this week. There has been a significant change in performance so I want to compare the the two builds to see what has changed. ANY IDEAS?........SUGGESTIONS? Cheers EDIT: Yes it would be better to compare the source code from version c...

populate a combobox with attributes of a selected xml node using c#

Im using c#.net windows form application. I have a xml file. I have loaded the node names of that xml file into a treeview. Now my task is , when I select a particular node from the treview, I should be able to display its attributes in a combo box. Please help. ...

Upload Files in C#.net Windows Application

Hi All I Want Upload some Files into a Website Host in C#.net Windows Application.what is a Best way To Upload file in Windows Application? ...