Consider, for example:
public interface IStaff
{
FullName name { get; set; }
EMailAddress email_address { get; set; }
SocialInsuranceId ssn { get; set; }
PositiveInt age { get; set; }
Address home_address { get; set; }
}
For some users, the viewmodel will only require name and email_address.
Others may have a view...
I wonder if there a "trick" that permits to know if the used objects in a portion o code has been properly(entirely) disposed, or, in other words don't creates memory leaks.
Let's say I have a container of GDI objects (or other that I need to explicitly dispose)
public class SuperPen
{
Pen _flatPen, _2DPen, _3DPen;
public Sup...
I have a library that returns a collection like this:
public IEnumerable Alerts { .. }
and I want to turn this collection into a BindingList for use in the GUI. What is the best way to keep a BindingList synchronised with an IEnumerable collection?
edit: For this problem, assume I have no control of the library and the actual implem...
When I click minimize button in my Windows Forms application, I don't want it to perform the classic Windows minimize animation (window going down to taskbar).
As far as I know, there's no Minimize event, I can just use Resize, but I have no clue how to detect if I clicked minimize button. I tried to use if ( WindowState = FormWindowSta...
I am writing an ASP.NET MVC 2 site with REST endpoints. I want to consume this service with ActiveResource in a Rails web application.
So far, I've managed to get routes setup in ASP.NET MVC that match the ActiveResource conventions. But where I'm having problems is with de-serializing the data that ActiveResource sends to the REST se...
Some browsers cache js and css files, failing to refresh them unless you force them to. What's the easiest way.
I just implemented this solution that seems to work.
Declare a version variable on your page
public string version { get; set; }
Get the version number from web.config key
version = ConfigurationManager.AppSettings["...
Hi,
I'm currently writing some software in C# which needs to connect to an AD server and get some user details. When I connect using the code below it works against most AD servers that I connect to but there are a couple where it fails with an error of "Logon failure: unknown user name or bad password.". The server name / credentials...
I'm trying to publish to a Facebook Stream using the Facebook Developer Toolkit v3 but I keep getting this error:
A session key must be specified when
request is signed with a session
secret
What I want is just to post a link using the more detailed Publish method.
My code looks like this:
First I setup a DesktopSession lik...
I noticed in System.Threading.TimerBase.Dipose() the method has a try{} finally{} block but the try{} is empty.
Is there any value in using try{} finally{} with an empty try?
http://labs.developerfusion.co.uk/SourceViewer/browse.aspx?assembly=SSCLI&namespace=System.Threading&type=TimerBase
[ReliabilityContract(Consistency.Will...
I'm trying to return a zip file, as a stream over a browser. This works fine with other types of files (e.g. Excel files) but when I start dealing with zip files I can't get my browsers to recognise that it's a zip.
Both Firefox and IE running on my test machine prompt, asking what program to open the file with. Explorer is set as the d...
I'm having problems proxying metods with parameters using Castle DynamicProxy v1.1.5.0. - I get the exception "Index was outside the bounds of the array."
If I only use methods with no parameters, OR DynamicProxy v2, everything works ok.
Unfortunately, I'm having trouble convincing the leads on my project to add a dependency to v2 (we'...
Is there any good implementation of actors concurrency model for .net/c#?
I have to optimize a c# routine and i think that actors model fits perfectly as a solution for my problem. Unfortunately i have experience only with scala implementation.
...
I've got a deadline for an initial release of a client-server application that will have lots of iterative releases subsequently.
NHibernate is the ORM of choice, largely by reputation and my desire to gain experience with it.
The problem is that I haven't even had a chance to spike NHibernate yet, and I'm afraid that doing so is going...
How do you bundle ActivSync with your C#.NET application? I have an installer and it works fine for the SQL Server 2005 Express and .NET 2.0 Framework when I selected them as prerequisites. I'd also like to setup ActivSync as a pre-requisite as well.
...
The called method have access to binding-level information like the origin IP address?
...
My VS2008 solution has the following setup.
Program1
Program2
Common.dll (used and referenced by both Program1 and Program2)
In debug mode I like to set my output directory to Program Files\Productname, because some code will get the exe path for various reasons.
My problem is that Program1 when compiled, will give an error that it ...
I'm specifically thinking about a collection that fulfills the contract of a set, but I think the question can apply to any kind. Are there collections in the .NET framework that prevent null entries? The specific behavior I want is this:
var set = new HashSet<object>();
bool added = set.Add(null);
Console.WriteLine(added); // prints "F...
Hi,
I have created a Custom Web Part in SharePoint 2007 using VS 2008 on the dev server. It uses the SQL DB. Everything works fine on my server with testing db which I recreated from the backup client gave me.
Now I'm moving it over to the clients' production server. I was able to deploy, install and activate it.
But when I'm trying t...
When using Monitor.Wait(object obj) what should one use for the obj? In this article I'm reading on multithreading in .NET the author instantiates a new Object() to be used only as a monitor lock. Is this what you should do in practice, or is it more typical to Monitor the actual variable shared between two or more threads?
...
I think that perhaps the original question was too long-winded with too many unnecessary details, so this is my attempt to simplify.
I am looking for a means to perform any of the actions below. I only need to do one, not all. If anyone knows the answer to even one of these, please respond. So, is it possible to do any of the followi...