.net

How to get parameter value from StackTrace

From within a method call I need to "jump" three layers up the stack and retrieve the type and value of the parameters passed to that method. Getting the parameter type is easy but I couldn't find a way to get the value passed to a certain method on the stack. var st = new StackTrace(); var frames = st.GetFrames(); var methodParameters ...

Can I use Microsoft Sync Framework to synchronize two SQL 2008 databases?

I've seen examples about synchronizing SQL 2008 with SQL CE. But not two SQL 2008 databases. If it can be done, have you seen example code about how to do it? ...

How can I format DateTime to web UTC format?

Hi, I have a DateTime which I want to format to "2009-09-01T00:00:00.000Z", but the following code gives me "2009-09-01T00:00:00.000+01:00" (both lines): Console.Out.WriteLine(new DateTime(2009, 9, 1, 0, 0, 0, 0, DateTimeKind.Utc).ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffzzz")); Console.Out.WriteLine(new DateTime(2009, 9, 1, 0, 0, ...

Embed a System.String in XAML

Is there a way to embed a string in XAML, give it and ID and refer to it later. I have tried: <Window x:Class="WpfApp1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib" ...

Visual Studio 2008 : Step to next line is very slow when debugging managed code

Hi, When stepping through my C# code line by line via F10, it takes the debugger over one second to get to the next line. I've tried deleting all watches and breakpoints, but that did not make any difference. Is this normal? It's been like this for quite a long time now, so I can't even remember if this was ever better. My developmen...

A good broadcast mechanism for inhouse .net applications to announce their location and version?

I would like to provide a large number of inhouse .net applications with a lightweight way to announce that they are being used. My goal is to keep track of which users might benefit from support check-ins and/or reminders to upgrade. This is on an inhouse network. There is definitely IP connectivity among all the machines, and probab...

.NET container for two-way conversion data?

Hi all, I have conversion tables I need to contain in memory for fast access. Until now I used a simple Hashtable were the Key was the internal code, and the Value was an object holding the external code and other meta-data. Now we need to have a reverse look-up, meaning to get the internal code based on the external code. I could only...

Is it possible to reuse a ProjectInstaller?

I have a solution with many Windows services and their ProjectInstallers are very similar. How to make a single Installer class in a library that is used by every WindowsService? I tried to do it, but it didn't work yet. The code below contains only part of a Installer [RunInstaller(true)] public partial class ProjectInstaller : Insta...

Dynamically Modifying a LINQ to SQL Select Statement's Columns

Hello, I'm trying to build a REST-ful API for my app. Currently I have something like this: www.example.com/submissions/?format=json This will return latest ten submissions in JSON. Each object has its details, such as submission name, date created, user, body, etc. I'd like to do something such as: www.example.com/submissions/?format...

With T4 templates, does it give you the database as an object where you can spit out code?

With T4 templates, does it give you the database as an object where you can spit out code? or do you need that tool visualt4? ...

Integer Relation Implementation (finding ratio between real numbers)

Can anyone point me to a library or module with a decent integer relation implementation (most likely PSLQ)? My target platform is .NET (C#), but if there's source code in C/C++, Java, whatever, even a semi-comprehensible algorithm, that would help me a lot. All I was able to find on Google was some unreadable Mathematica code. I was ...

How to intercept WCF class creation

I have a wcf service for which I am not using a service reference. The classes and interfaces are defined in a dll both the client server reference. Communication with the server uses a class derived from ClientBase. I want to intercept wcf's default objects creation on the client side, so that I can provide a subtype that implements IN...

IronRuby and Handling XAML UI Events

What it is the most brief and concise way of adding event handlers to UI elements in XAML via an IronRuby script? Assumption: the code to add the event handler would be written in the IronRuby script and the code to handle the event would be in the same IronRuby script. I'd like the equivalent of the following code but in IronRuby. Hand...

How do you add a primary key to a sql view? - Or alternate way to link views to linq-2-entities

I'm adding a very simple view (or trying to) to my entities object model. The database is in sql server 2008. I'm on .net 3.5 (sp1) using C#. The view has two fields: color and colorcount, a Varchar(50) and a count(*) respectively. When I do Update Model from Database, and select the view to add, it runs (it updated tables, adding ...

How to emit explicit interface implementation using reflection.emit?

Dear ladies and sirs. Observe the following simple source code: using System; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; namespace A { public static class Program { private const MethodAttributes ExplicitImplementation = MethodAttributes.Private | MethodAttributes.Virtual | Meth...

How do I select the client only framework in a Managed Visual C++ project in VS 2008 Sp1?

The title said it all. ...

How can i find a control in the footer template of a data repeater

ASPX : Code <asp:repeater id="repeater" runat="server"> <headerTemplate></headerTemplate> <itemtemplate></itemtemplate> <footerTemplate> <asp:literal id=findme runate=server> </footerTeplate> </asp:repeater> What i am looking for is source code to be able to find the control within the footer of a data repeater. Im...

JSON.Net serialization and custom objects

So I was working toward a fairly lightweight approach at serializing some of my objects, and was hoping to use NewtonSoft's JSON.Net. The challenge is that I'm trying to use a simple interface for serializing an IDictionary. T in this case will be one of several entities in my domain that all have a Guid id (which becomes its key in th...

WCF Service, how to get the web site URL from within a class library?

I have a WCF service running in IIS that calls a function in a class library where httpContext is available. How can I dynamically get the web site url, this may also be a virtual directory? ...

How do I reference classes using IronPython?

I want to use IronPython as a simple test harness for a .net application. I have created a project in Visual Studio 2008 and have an empty python source file. I have added my assemblies to the project in Visual Studio. I am familiar with general python programming. How do I import and use classes from my referenced assemblies? ...