.net

WCF Service complains about columns marked as rowversion

I am currently playing around with Silverlight3, C# and LinqToSQL . I have build up a database on a SQLExpress Server with some tables for example: Employees ( Id, Name, DepartmentId, TimeStamp ) Departments ( Id, Name, TimeStamp ) The Id fields are VarChar(50), the Name Fields are VarChar(100) and the TimeStamp fields are of type time...

right click context menu for datagrid

I have a datagrid in a .NET winform app. I would like to rightclick on a row and have a menu pop up. Then i would like to select things such as copy, validate, etc How do i make A) a menu pop up B) find which row was right clicked. I know i could use selectedIndex but i should be able to right click without changing what is selected? ri...

Why does stack get truncated in Exception.StackTrace?

Why does the high part of the stack (in Exception.StackTrace) gets truncated? Let's see a simple example: public void ExternalMethod() { InternalMethod(); } public void InternalMethod() { try { throw new Exception(); } catch(Exception ex) { // ex.StackTrace here doesn't contain ExternalMethod()! } } It seems l...

What are the real-world pros and cons of each of the major mocking frameworks?

see also "What should I consider when choosing a mocking framework for .Net" I'm trying to decide on a mocking framework to use on a .NET project I've recently embarked on. I'd like to speed my research on the different frameworks. I've recently read this blog post http://codevanced.net/post/Mocking-frameworks-comparison.aspx ...

Is there a way to use .NET's built-in HTTP classes to parse "raw" TCP streams as HTTP from memory?

I am wondering if there is a straightforward way to use .NET's built in HTTP support to parse arbitrary bytes into nice HTTP requests and responses. For example, I would like to be able to pass in a byte array containing "HTTP/200 OK\r\nContent-Type:...." etc and get out some structure representing the status code, and decoded content. ...

visual basic 2008 32bit/64bit ?

can vb.net 2008 bet set to only run in 32bit? ...

C# Passing value of a list element to update local variable

I have a few local variables and I want to divide them all divide them all by the same number. decimal a = 0; decimal b = 0; decimal c = 0; ... decimal n = 0; decimal divisor = 0; <perform calculations to give all variables meaningful values> divide each decimal (a - n) by divisor then assign value Beside dividing and assigning eve...

ASP.NET Forms Authentication Default Redirect [Working] and Redirect to Requested Page w/QueryString [Not Working]

I have a website, with basic Forms Authentication working alright. Users have emails that contain links to my site, with a querystring variable. Users are prompted to login correctly, but using FormsAuthentication.RedirectFromLoginPage(userName, false); Does not work when the original url contains a querystring. I've tried these requ...

How to iterate all "public string" properties in a .net class

Lets say I have some random .cs file containing a class with some properties and methods of all sorts. How can I iterate the names (as strings) of all these public string properties? Example.cs: Public class Example { public string FieldA {get;set;} public string FieldB {get;set;} private string Message1 {get;set;} public int some...

Code Review: Is this the most efficient/elegant way to recursively walk a tree

This is more of a general question so the answer does not have to be in C#. I have a general code structure below that I use to recursively walk a tree structure. In this particular case I am appending to a string builder object in each iteration. Is there a way to improve this code to be faster or better? public static void Recur...

How can I receive emails in C++ via POP3?

Hey guys, I've been trying to find a POP3 C++ client on the internet but I haven't found any luck. We are working on a project for school that is essentially a C++ course (so I can't use C#...), and we are making a Email client that has to support sending and receiving emails and attachments. We are also working with .NET (because app...

Need help for complex SQL query in NHibernate

I need to know how I can rewrite the following SQL query in NHibernate's ICriteria format. It is basically a way to mimic the MS-SQL's RANK() feature and return only those results that are most current. SELECT a.Name, a.Value, a.CreationDate FROM MyTable a WHERE EXISTS ( SELECT NULL FROM ( SELECT TOP 1 CreationDate FROM M...

.NET to consume BW Soap over JMS Service

Hi All, I am able to consume a BW Soap over HTTP service in C#.NET but struggling with BW Soap over JMS Service. When I included the WSDL file under web references and compiled. Here is the warning that is displayed. "At least one import binding for the ServiceDescription is an unsupported type and has been ignored" My understanding...

How do I convert a c++ string to a .NET String^ ?

I've been trying to figure out how to convert a string to a String in Visual Studio 2005 with no luck. Here is the relevant code: #include <string> using namespace std; #using <System.dll> using namespace System; string test = "a test string"; So I'm trying to convert test into a String^ to use inside other .NET classes, can anyone ...

.NET Exceptions - localization

With applications now being developed for users of many nationalities, localization is very important. I read on firefox's web site it is available in 70 languages. This increases their potential market dramatically. During a recent user acceptance testing session for my project, a bug was found. The exception was: "String was no...

Serving REST Services

Hi everyone, How can I write this output to the stream ? I want to write element to the stream as text/xml format. I am just trying to create simple REST service. I want to use element.Save method. <%@ WebHandler Language="C#" Class="Calculation" %> using System; using System.Web; public class Calculation : IHttpHandler { public...

Does anyone know of an HTTP Server library that works on the Compact Framework?

I am creating a remote test runner for Gallio. My plan is to create an HTTP Web Service server. I am comfortable creating the server myself, but I would prefer to use an existing HTTP server. Does anyone know of an HTTP server that is appropriate for building a web service server. It would be ideal if it is open source. Pat O ...

Does a reference to a delegate constitute a reference to an object (to prevent garbage collection)?

I had trouble coming up with a good way to word this question, so let me try to explain by example: Suppose I have some interface. For simplicity's sake, I'll say the interface is IRunnable, and it provides a single method, Run. (This is not real; it's only an example.) Now, suppose I have some pre-existing class, let's call it Cheetah...

SpeechSynthesizer - How do I play/save the wav file?

I have the following code snippet in an ASP.NET app (non Silverlight) string sText = "Test text"; SpeechSynthesizer ss = new SpeechSynthesizer(); MemoryStream ms = new MemoryStream(); ss.SetOutputToWaveStream(ms); ss.Speak(sText); //Need to send the ms Memory stream to the user for listening/downloadin How do I: Play this file...

C# solution for analysing files as they are written/modified

I have several projects that require me to monitor files, and then edit them as they are getting written to disk. I have a feeling that what I am looking for is operationally the same as how anti-virus tools operate. Let me give more details: 1) I need to trap all files saved by Office application, and then add specific company tags to t...