Re-entrant locks in C#
Will the following code result in a deadlock using C# on .NET? class MyClass { private object lockObj = new object(); public void Foo() { lock(lockObj){ Bar(); } } public void Bar() { lock(lockObj){ // Do something } } } ...
Will the following code result in a deadlock using C# on .NET? class MyClass { private object lockObj = new object(); public void Foo() { lock(lockObj){ Bar(); } } public void Bar() { lock(lockObj){ // Do something } } } ...
I see on the web there are a lot of questions about caching ASP.Net, but not a lot of discussion on caching options for a Smart Client Application and their databases. What are the data caching options that are available for Smart Client Application on the .Net framework, and how are any of you using them? Edit Enterprise Framework ...
I do not want the user to be able to change the value displayed in the combobox. I have been using Enabled = false; but it is very readable like when setting a Textbox.ReadOnly = true; Is there is a way of accomplishing this? Thanks, Kishore. ...
I already asked this question at the JOS-.NET board but Joel is closing that board down so here it is again: Do web hosting providers allow you to install Windows Services? I want to play around with some automation stuff, which I can currently do fine from my own dev pc, but I would like to start opening this stuff up to the public. Ho...
What are the Resharper 4 shortcuts to Create a class from usage? e.g. I type "var p = new Person();", and I want to now create the person class. Move this class to its own file? When the Person class exists in the same file next to my Order class, what is the shortcut to move it. I can't seem to find these shortcuts on the cheatsh...
I'm confused about Linq to Entities. Is it the new name of Entity Framework or are they different things? ...
Application 1 - Opens a SqlConnection and a SqlTransaction against a SQLServer 2005 database Inserts a record into Table1 Does not commit or roll-back the SqlTransaction - intentially keeping this alive to demonstrate / describe the problem Application 2 - Opens SqlConnection and a SqlTransaction against a SqlServer 2005 database...
My development machine ( 32 bit Windows XP) runs excruciatingly slow when I am doing .Net development in Visual Studio 2008, thanks to the installation of Resharper. So I am thinking about switching my development machine to 64 bit Windows XP. Not sure whether such a switch will speed up the development or not? 64 bit machines don't ha...
I'm using a TableAdapter for the first time and adding a custom query to it, and I'm getting stuck on adding some search parameters to my query, here's what I've got: SELECT * FROM Orders WHERE (id_order = @id_order) OR (IsFor LIKE '%@word1%') OR (IsFor LIKE '%@word2%') OR (IsFrom LIKE '%@word1%') OR ...
After running a insert or update query against a SQLServer 2005 database, under what scenario (if at all) can this happen - SQLServer 2005 does not perform or fails to perform the insert / update, AND ALSO DOES NOT "THROW" AN EXCEPTION? Consider that we are running the insert or update query via a SqlCommand object. Also consider that t...
We have a .Net application from which a C++ COM component is being instantiated. We load the COM component from a child form window. There is a common resource that is being edited by the .Net application, which inturn is being used by the COM dll to start up. When the following sequence of steps are performed: 1. Instantiate COM com...
Hi folks, i'm not sure how to correctly format a .NET DateTimeOffset variable, as a string, for SqlServer 2008 to correct parse the value. currently, if i provide the default .ToString() value from a normal DateTimeOffset value, it errors. Here is a sample .ToString() value that errors (eg. Sql2008 doesn't like it): '25/12/2008 2:12:2...
I have a few procedures, for simplicity sake, look like the following: public string FetchValueAsString(string key) public int FetchValueAsInteger(string key) public bool FetchValueAsBoolean(string key) public DateTime FetchValueAsDateTime(string key) I know I could just have one method that returns and object type and just do a conve...
Is there a standard .Net matrix class? I cannot find it if there is. If not, why not? It sounds like something people would need very frequently. Are there any non-standard libs you could recommend? ...
How do I create my own primitive? For example an integer that has a range of to 1-10. EDIT: This came from a task on Rosetta Code. Defining Primitive Data Types: Demonstrate how to define a type that behaves like an integer but has a lowest valid value of 1 and a highest valid value of 10. I added it here because I thought it mig...
I use Javascript to click a link in the webbrowser control. But I don't want to hear IE's "click" sound. Is there anyway to do this? P.S. I don't want to change system settings. I've seen this one(http://stackoverflow.com/questions/10456/howto-disable-webbrowser-click-sound-in-your-app-only) but Document.Write is not an option for ...
Background I am automating some Office application (Word and PowerPoint) via command-line tool. One thing my tool needs to do is locate all the running instances of Word. I know how to get a reference to one of the instances... Object running_obj = null; { running_obj = System.Runtime.InteropServices.Marshal.GetActiveObject(progi...
I am looking for a control to be able to embed the functionality of the FileOpenDialog without the idea of using a modal dialog. Does something like this exist already? (ideally within .Net 2.0 framework, C#). ...
I am just getting started with NHibernate (for the 15th time it would seem) and am having the following problem. The following table: Table Facility Column FACILITY_ID integer Column NAME varchar2(50) Column MONTH varchar2(5) For whatever reason, month is a string instead of a native Date type and looks like this: "200811" represent...
I'm trying create a moving rectangle (rect). This is the relevant code: let timer = new Threading.DispatcherTimer(); timer.Tick.Add(fun _ -> Canvas.SetLeft(rect, Canvas.GetLeft(rect)+0.01) |> ignore) timer.Start() The problem is that the animation is slower if I move the mouse over the window. If I set the timer's interval: timer.Int...