I have got a server that controls a complicated industrial system.
We need to write a remote client that can connect to the server and "observe" its internal state. I need to work out:
How to establish the current state when the client connects
How to keep the client up to date with changes on the server
Do we replicate all of the obj...
Dear ladies and sirs.
Observe the following code:
[AttributeUsage(AttributeTargets.All)]
public class XAttribute : Attribute
{
}
public struct A
{
[X]
public static extern int XX { get; }
}
This does not compile. The error message says
The modifier 'extern' is not valid for
this item
But, the following code compiles OK:...
Good morning everyone!
I'm doing a distributed application using .NET 4.0, C# and Remoting (IPC at the moment but that may change, Object is WellKnownObjectMode.Singleton).
Upon startup of the client I'd like to test whether the server is up and running.
What would be the best practice to implement this? Call any one method? Impleme...
hi
I have created a function to implement the regex.split in sql. Here's the code:
private static IEnumerable<IndexedValue<T>> ToIndexedValue<T>(IEnumerable<T> list)
{
int idx = 1;
foreach (T value in list)
yield return new IndexedValue<T>(++idx, value);
}
private struct IndexedValue<T>
{
public int Index;
public T Value;
...
I'm trying to write REST-behaviour into my ASP.NET MVC2 app, but I'm having a hard time figuring out how to make the routes work as I want.
I'd like my routing to work like this:
/Users/Get/1 <- returns a regular HTML-based reply
/Users/Get.xml/1 <- returns the data from Get as XML
/Users/Get.json/1 <- returns the data as JSon
I've t...
Does this make sense ?
Having a simple class
class Test
{
public Test()
{
// Do whatever
}
}
and then instantiating it
using(new Test())
{
// Nothing in here
}
The using statement is there just to make sure Test is disposed.
When will it be disposed if I just call
new Test()
...
I am trying to optimize a LINQ to SQL request so that it results in a single SQL statement. At the moment i have something like this:
EDIT : removed the "where" filter for clarity - also "Id" is a primary key in the databsse for both object types
hotel = (from h in db.Hotels
let rooms = (from r in db.HotelRooms
...
Hi,
How to generate dynamic calendar controls based on default calendar control's selectionchanged event?
...
Hi,
When I am working with NHibernate (I am a beginner of it btw) I am able to obtain the SQL calls to Db in my output. But I am not able to make them work after I copy and paste into Management Studio.
Because it is missing the parameter declarations.
I get something like:
SELECT this_.PK_Product as PK1_1_0_, this_.ProductCode as P...
I have a custom ApplicationContext and I'm trying to terminate it if specific conditions are met. I am using a Mutex to ensure a single instance.
I've tried base.OnMainFormClosed(null, null);. Application.Exit() and ExitThread. Everything stops processing, but the process itself is still running.
Complete Main() method:
static void ...
Below are my custom rule assembly and embeded xml resources file. My assembly name and the default namespace name are both MyRules. I just cannot figure out why it could be SO SO difficult to add a custom fxcop rule? I always got the "no rules were selected" error. I am going crazy...
using System;
using System.Collections.Generic;
usin...
What is basic need of xml transformation? In which situation we can use this ? can we use this in .Net?
...
Hello,
I would like to compare two versions of a class. I have used WinDiff, but it shows a lot of differences because of different commenting etc.
Does anyone know of a tool to compare two class definitions (fields, methods etc.) for .NET?
Thanks,
Martin
...
I have created a wspbuilder project and I have a a small application(working) that returns documents that use a certain content tpye.
However creating an admin page is proving somewhat difficult.
I imported an aspx page in to my project and have the page in the layouts folder which i believe to be correct. If i add control in to the as...
Using C#
In my webpage style sheet is not loading, i am using Google Chrome Browser
Code.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Data Entry</title>
<link rel="stylesheet" href="G:/style.css" type="text/css" charset="utf-8" />
</head>
</html>
The above code is not loading the style.css file.
How ...
I want to simulate user input to a WPF TextBox. I want to input a character such that the OnPreviewTextInput event is triggered. I tried setting the Text through the Text property, but this didn't trigger the event:
public void SomeFunction()
{
var textBox = new TextBox();
textBox.Text = "A";
}
Can I trig...
Having a EF Context and a Testenity I want to get the following test to work.
TestEntity testEntity = new TestEntity() { Name = "Hello World" };
context.TestEntities.AddObject(testEntity);
// missing Code
Assert.AreEqual(1, context.TestEntities.Count(), "Entity not in context!");
I know that it works with SaveChanges() but I do not w...
I did a simple test to understand how transactions work in .net
Sample code on which my transaction test was done is
_sqlHelper = new SqlHelper(true);
try
{
_sqlHelper.ExecuteNonQuery(SpName.sp_UpdateRoomStatus.ToString()
, Parameters.SqlParam<int?>("DepartmentId", this.DepartmentId, SqlDbType.Int)
);
_sqlHelp...
Hi All
am creating a buttons dynamically.In my MainView.xaml,am binding these buttons to Canvas with contentcontrol here all buttons are generating as a single control now i have to spit those controls to use..
how can i do this?
here is my canvas code
Canvas Background="White"
Height="421" HorizontalAlignment="Left" Ver...
I am looking at using design by contract for a personal project in C# using .NET 4.
I have been reading about Microsoft's attempt at a design by contract framework:
http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx
But there are many alternatives and I'm baffled - so which is the best and why? What are the pros and cons of each?
...