.net

Object initialization in CSharp

When i have declaration like: class Professor { string profid; public string ProfessorID { get { return profid;} set { profid=value;} } student st; } class student { string name; string id; public string Name { get { return name;} set { name=value; } } public string StudentID { get { ...

Serial Comms programming structure in c# / net /

Hi, I'm an embedded programmer trying to do a little bit of coding for a communications app and need a quick start guide on the best / easiest way to do something. I'm successfully sending serial data packets but need to impliment some form of send/ response protocol to avoid overflow on the target system and to ensure that the packet...

shrink or compact in Sql Server CE?

I am using Visual Studio 2008. and i am new at sqlce.I am checking sdf file and if sdf doesnt exist,I create and then insert around 5000 rows to my sqlce db.If sdf exists,first i delete all tables's rows and then insert these records to existed tables.After insert complete,i am compacting database.By the way,compacting lasts about 13 se...

DataTable.AsEnumerable().Distinct() doesn't work because of primary key column

I want to remove duplicates from my DataTable so I'm using DataTable.AsEnumerable().Distinct(DataRowComparer.Default) but it doesn't do what I need. I think because each duplicate row has it's unique primary key column. How can I do what I need? Write my own DataRowComparer? I don't want - because the default must works. ...

Strongly typed .net -> sql data access ?

I know what i want but not sure of the name and required tools so here goes... I have a few different sql tables. I want a tool that will generate an object in my .net project for each table, with each column a property of this object. (i.e. strongly typed, no datatables) I want to be able to call select, insert, update and delete met...

What is the difference between a RoutedCommand and a RoutedUICommand?

I have tried to do some reading about it, but I failed to find documentation that explains the difference between RoutedCommand and RoutedUICommand satisfactorily. ...

Clinical Lab Interface programming

Hi, I am a .NET programmer. Are there any web based resources to pick up Clinical laboratory interface programming, using Serial Ports and ASTMH protocol ? Or any books ? When i googled i found the ASTMH site which apparently publishes the standard. My specific problem is that i have developed a C# program to connect a Lab Info System...

Sending keys to inactive application in C#/.NET

Hi, I have an application with combobox that contains names of currently running applications. As I understood from msdn library, SendKeys method can send keys only to active application. Is it somehow possible in .NET, to send keys also to inactive app? Or at least in WinAPI ? ...

Problem with using and Stream

I call method in Soap extension which decrypt and verify sing Soap message. I have this classes: I have class, which decrypt and verify sign Soap message, which return stream back in Soap extension class : Method DecryptAndVerifySingXml and GetGuid use stream from class soap extension. public class CryptUtility { public virtual S...

struggling with XML namespaces (linq)... what am I doing wrong here?

Hi, Trying to parse some XML but apparently this is too much for a lazy sunday afternoon, this is my code: (I Tried the XPathDocument and XmlDocument approach too but this also failed miserably) XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(postData); XDocument xDoc = XDocument.Load(new XmlNodeReader(xmlDoc)); XNamespac...

Implicit Type Inference only for lambda expressions ? Why ? Confused !

I have the following sample code (used for C# 3.5 study purpose only !). I am making a call to the Sort function that accepts an IEnumerable and a sort function. If I call it using a lambda expression (Case A) the compiler can derive the return type TResult, however when I pass the func SortInt (Case B) the compiler throws an error ! ...

Preserving original StackTrace/LineNumbers in .NET Exceptions

Understanding the difference between throw ex and throw, why is the original StackTrace preserved in this example: static void Main(string[] args) { try { LongFaultyMethod(); } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } } stat...

Can I use a .net control parent class to enable/disable it?

I need to write a delegate for a multi-threaded program that will enable/disable a variety of controls. It seems logical that using one handler for all controls would be the best choice, but I'm not even sure this is possible in .net and if so how to implement. ...

Building and running VS2005 project on linux with MonoDevelop?

Hi - I have a VS2005 project that I'm trying to run on linux. First - is it even possible? The project is .NET 2.0, and I have mono JIT 2.0.1 on my linux machine. The project builds successfully in monodevelop, but when I run it I get the exception stack: Unhandled Exception: System.NotImplementedException: The requested feature is not ...

Does Resharper Code clean up support this

Hi all, I have a project with a bunch of classes with methods that look like this: public class Person { private string _name; ... public void setName(string name) { this._name = name; } public string getName() { return this._name; } .... } Is there a way to get reSharpers Code cleanup...

How to set ID in Object Oriented Code.

I'm a bit confused when it comes to Object oriented programming for say a 3 tier application. Here is just a small example of what I am trying to do (I will shorten the database design to make it simple). Assume I am making a ticket help desk system. A ticket has a description, a responsible person, a due date, and of course an ID (un...

detect Windows Explorer copy operation

Is there any way to detect whenever a copy operation starts in Windows Explorer. kind of like in SuperCopier : SuperCopier Website ? and log files involved in the operation ? and such ? I've browsed through Supercopier code and I can't find the part which deals with detecting the copy operation, as I'm not fluid in Delphi. P.S : it s...

asp.net shall i cache a 5 kb file?

im using a handler to serve user avatars. if there is no avatar set its reading noavatar.jpg from file system and binarywrite to the client. is it good idea to cache this 5kb noavatar.jpg to memory and serve from there? I am concerned because avatar handler gets quite alot of requests. ...

Scheduled .NET code execution in hosted environment?

I've got about 40 lines of .NET code in a console application that read and RSS feed and store information in a database. I need this code to execute every night for as long as the RSS feed exists (indefinitely). Currently, I just launch the console app. from my home computer. Because I can't trust myself to remember to do this every n...

Setter precedence overriding in WPF?

Look at the line "THIS LINE ####" in following example. <ListBox Grid.Row="0" x:Name="listBoxServers"> <ListBoxItem HorizontalContentAlignment="Stretch"> <StackPanel> <TextBlock><Run Text="My computer"/></TextBlock> <TextBlock Foreground="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"> <Te...