While I playing with the C# 4.0 dynamic, I found strange things happening with the code like this:
using System.Dynamic;
sealed class Foo : DynamicObject
{
public override bool TryInvoke(
InvokeBinder binder, object[] args, out object result)
{
result = new object();
return true;
}
static void M...
It is generally accepted (I believe!) that a lock will force any values from fields to be reloaded (essentially acting as a memory-barrier or fence - my terminology in this area gets a bit loose, I'm afraid), with the consequence that fields that are only ever accessed inside a lock do not themselves need to be volatile.
(If I'm wrong a...
We're working with some very large config files which contain lots of Unity and WCF configuration.
When we open some of these configs in the SVC config editor or even try to open a web application using these configs, we recieve errors showing any typos or errors. E.g. a WCF binding is invalid or does not exist etc, or a configuration s...
I'm utilizing the code posted by Jesper Palm here: http://stackoverflow.com/questions/280891/make-user-control-display-outside-of-form-boundry
/// <summary>
/// A simple popup window that can host any System.Windows.Forms.Control
/// </summary>
public class PopupWindow : System.Windows.Forms.ToolStripDropDown
{
private System.Window...
What is the best practice for when to implement IDisposable?
Is the best rule of thumb to implement it if you have one managed object in the class, or does it depend if the object was created in the class or just passed in? Should I also do it for classes with no managed objects at all?
...
Hello,
We are entering custom project in which we need to build platform for other programmers in order to communicate with a specific device. This device is to be used on daily basis. We have firmware and RS232 communication protocol with them on very low level.
We must ensure .NET, Java and Delphi programmers to access device (send co...
Just wondering what everyones thoughts on what ORM to use for SQL Azure?
I'm fairly comfortable using LINQ-to-SQL and I believe it is possible to get it working with SQL Azure. However, from my understanding (correct me if I'm wrong), no further improvements will be made to Linq-to-SQL in future releases of the .NET framework?
Alter...
I have some useful wpf buttons to test some functionality. It would be good not to show them in release but in debug indeed.
Doing it from code is easy. But I'd prefer a declarative solution.
...
Hi!
I'm using VB.NET for a web-application that starts some process using CreateObject, like this:
Dim AVObject = CreateObject("avwin.application")
After all is done everything get closed down en stopped using the proper release functions, however, for some reason the process remains.
Is there some way in which I can get the proces...
I want to query a xml file.
I read this http://weblogs.asp.net/scottgu/archive/2007/08/07/using-linq-to-xml-and-how-to-build-a-custom-rss-feed-reader-with-it.aspx ,
But in my case i don't know the names of elements and attributes of the file.
So i could i do ?
Thanks
...
How do I get Active Icons in system Tray programmaticaly Vs2005 c#?
Any Ideas?
...
I have a custom IErrorHandler which catches certain exceptions thrown from web services and translates them to HTTP status codes. The problem is that, even when the handler sets the status code (404 for example), the Web server (IIS 7.5) always returns 400 (Bad Request). I tried other status codes and the result is the same ("The server ...
What are the pros and cons of using either of the following approaches to pulling out a double from an object? Beyond just personal preferences, issues I'm looking for feedback on include ease of debugging, performance, maintainability etc.
public static double GetDouble(object input, double defaultVal)
{
try
{
return Co...
I have defined my binding thus:
<TreeView
ItemsSource="{Binding UsersView.View}"
ItemTemplate="{StaticResource MyDataTemplate}"
/>
The CollectionViewSource is defined thus:
private ObservableCollection<UserData> users;
public CollectionViewSource UsersView{get;set;}
UsersView=new CollectionViewSource{Source=users};
Us...
DatarowsForOneDay = dt.Select(
dt.Columns[0].Caption + "='" + x.ToString("dd/MM/yyyy HH") + "'");
doesn't work, but
DatarowsForOneDay = dt.Select(
dt.Columns[0].Caption + "='" + x.ToString("dd/MM/yyyy") + "'");
works.
So how can I select the date with a same hour?
Variable x type is DateTime.
...
I want to share a dll in between two projects.
Is it necessary to put the dll in GAC only or can I place it in any folder?
...
Hi,
We're getting following problem while using System.Threading.Timer (.NET 2.0) from a Windows service.
There are around 12 different timer objects..
Each timer has due time and interval. This is set correctly.
It is observed that after 3 to 4 hours, the timers start signaling before their interval elapses. For example if the timer ...
My WPF application is structured using the MVVM pattern. The ViewModels will communicate asynchronously with a server, and when the requested data is returned a callback in the ViewModel is triggered, and it will do something with this data. This will run on a thread which is not the UI Thread. Sometimes these callbacks involve work that...
Hi, let's say that I have a table called
Items (ID int, Done int, Total int)
I can do it by two queries:
int total = m.Items.Sum(p=>p.Total)
int done = m.Items.Sum(p=>p.Done)
But I'd like to do it in one query, something like this:
var x = from p in m.Items select new { Sum(p.Total), Sum(p.Done)};
Surely there is a way to call agg...
I have a asp.net mvc site that references a couple of libraries. Recently I discovered that it is necessary to migrate those dlls to .net 4 (I mean compile them for .net 4). Can I run asp.net mvc 1 on .net 4. Migration to asp.net mvc 2 is postponed because of the removal of response.WriteSubstitution(...) method.
...