.net

Performance problems with displaying a WinForm dialog from WPF application.

I am currently developing a WPF application that will utilize existing WinForm dialogs. I'm experiencing a long lag between the time I call ShowDialog() on a WinForm to the time it is displayed. Even when reusing WinForm dialog objects the lag time is nearly as bad on the second hit. Meaning that the problem isn’t in the constructor. D...

.NET: Custom format for web service documentation?

For a web service created in .NET, navigating to the service in a browser results in a somewhat brief listing of methods in the service and any description that is provided. Is there any way to customize the format of the documentation for .NET web services? Customization might include something as simple as customizing the styles on...

WPF, 'Object reference not set to an instance of an object' in Designer

I'm getting an "Object reference not set to an instance of an object" error when I try to reload the Designer for my XAML UserControl. Visual Studio highlights the following line as being the problem: <local:TemplateDetail Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="3" Width="600" TemplateData="{Binding ElementName=cbo_templates,...

MVC philosophy applied to webforms.

I'm pretty new to programming in general (really started only 2 1/2 years ago) and I'm trying to decide what the best way is to approach a web app I'm making at work. A senior developer at work is encouraging me to get into MVC and after a good 24 hours of pouring over blogs, source code and other material on the subject I'm beginning to...

How to build a multiple specific validation rule

Hi, I have an application that must be prepared to work in various companies. But I fear that every company needs specific validation rule. What is the better way to perform validation in my presentation layer without having to recompile my application for each client? ...

VB.NET: Get class name of a instance

Is there a way to get the instance's class name with VB.NET? ...

How to measure the amount of memory an individual object takes in .NET

Hey all, I'm wondering if there is a simple command or instruction in C#/.NET and/or Visual Studio that can tell me how much memory an individual object is taking up? I have a sneaking suspicion that the sizeof() operator is going to lie to me ... am I justified in this belief? There is a somewhat related question here, but no definit...

Replacing a db4o stored object with an instance of a subclass

I want to change all objects that match a condition to use a specific/new subclass. There are no other subclasses being used with the stored objects, so its in all cases a change from the base class to its subclass. In order to keep all references pointing to these objects, I tried using bind to replace them with new instances of the s...

Monitor performance of Module

Hi, I have written a module. I wanted to test the run-time performance of the module (processor and other resource utilization) on various platforms, like on a Netbook, Laptop, Android Mobile Phone etc. I would like to monitor the performance of only the thread that is running my module and not the overall resource/processor utilizati...

VB.NET: Who called the shared method?

Hi, I have a parent class (Foo) with shared methods. It is MustInherit. Bar and Baz classes inherits from Foo. I will do something like that: Dim baz as New Baz() Dim bar as New Bar() baz.sharedMethod() bar.sharedMethod() Within of Foo's sharedMethod(), I need to know who (class name) called it. So, using the above example, it would ...

MS Access DB Query String Parameter Issue

I'm having some trouble getting results from a c# OleDbCommand on an MS Access database. Here's my command: SELECT START_DATE FROM tblVisits WHERE LocProj_IS_NUMBER = @projId AND LocSTATN_IS_NUMBER = @statnId AND LocSTATN_ORG_ID = @orgId AND LocProj_ORG_ID = @orgId If I call this using parameters, I get no results, BUT if I replace @o...

Performance Counters

Hi, using System.Diagnostics.PerformanceCounter, I want to write results after every 'x' minutes. Is there any function supported for this or will I have to write some kind of event that gets invoked after every 'x' minutes? Thanks ...

Can I use Page.IsPostBack from BasePage?

I have a web form page Default.aspx, which inherits from a BasePage class that I created, which in turn inherits from System.Web.UI.Page. Very common setup. Default : BasePage : System.Web.UI.Page Within the BasePage.BasePage() (constructor), I want to do something if we're not doing a postback. So I put the standard if(!Page.Is...

Can you recommend a speech synthesiser for .NET?

I've used the built in speech synthesiser with C#/.NET but the options are limited and I'd like something more flexible. Any recommendations? ...

Azure development storgare service running as a windows service

I am working on a project that is a very large central media repository that uses Azure storage to house all of our external binaries that will be cosumed by 3rd party applications. We have the app working with azure, but are now moving forward to adding a bunch of new features and the "develop and test from you local box" form of testi...

Force XmlSerializer to serialize DateTime as 'YYYY-MM-DD hh:mm:ss'

I have a XSD schema for some RESTful service. When used in conjunction with xsd.exe tool to generate C# code, XSD's xs:date generates the following code: [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType="date")] public System.DateTime time { get { return this.timeField;...

ASP.NET MVC routing and file path

I have a controller action that has the same name as a file path. Like: www.example.com/userfiles/path/to/userfile.jpg Basically I have a userfiles controller and on the index action everything after userfiles/ is a path. There is also a userfiles virtual directory in the root of my application. What I want to happen is that if the di...

Is it better to create proxies for table with multi-faceted domains or use inheritance?

I'm using NHibernate and Dynamic Proxy. I have one table (Customer) with generic fields: charField1, charField2, etc. One record in this table may represent company A while another record may represent company B. However, a different domain model will exist for company A's data than company B's data because they require different informa...

.NET regex captures not in expected order

In .NET, regex is not organizing captures as I would expect. (I won't call this a bug, because obviously someone intended it. However, it's not how I'd expect it to work nor do I find it helpful.) This regex is for recipe ingredients (simplified for sake of example): (?<measurement> # begin group \s* # o...

How to convert foreign string representations of number with decimals into doubles?

I am at an internship where there is parsing done on strings read from a XML file. Specifically the strings are representations of decimal numbers. A problem arises when I try to parse a decimal string formatted differently than the ones that have comma separators and a decimal point. For example the way that nations format their decimal...