.net

Is an Incremental Approach Possible for This Case?

I'm taking data from an XML file of records that I'm using System.Xml.Serialization.XmlSerializer to deserialize into strongly-typed data structures. Each record that I run through is getting converted to another format and written to another file. I dislike the idea of storing the whole XML file in memory without need, but it's not cr...

How do I override ToString() for a Dictionary

I have a Dictionary<string, FieldDefinition> dependency property that when I bind it to a WPF list box I want it to just print the string (not the FieldDefinition). Is there a way to do that? ...

Is there a .Net library similar to GNU readline?

I'm considering writing a console application in C# and I want to incorporate history, completion and command line editing features something like GNU readline (but not necessarily as extensive as that!) Is there an existing library for .net which provides this type of functionality? I guess one option would be to use interop services t...

TreeView MouseLeave event fires when moves over ScrollBar

In the TreeView, ListBox, or it seems from my google searches anything with a ScrollBar, the ScrollBar is not considered a part of the control. I have a TreeView that I'm putting into a custom control, and it's Dock Fill. So there it acts as a custom TreeView which has all our logic to manage it in one place. In parts of our program we...

How to pass ctor args in Activator.CreateInstance or use IL?

I need a performance enhanced Activator.CreateInstance() and came across this article by Miron Abramson that uses a factory to create the instance in IL and then cache it. (I've included code below from Miron Abramson's site in case it somehow disappears). I'm new to IL Emit code and anything beyond Activator.CreateInstance() for instant...

When is the value of a C# 'out' or 'ref' parameter actually returned to the caller?

When I make an assignment to an out or ref parameter, is the value immediately assigned to the reference provided by the caller, or are the out and ref parameter values assigned to the references when the method returns? If the method throws an exception, are the values returned? For example: int callerOutValue = 1; int callerRefValue...

Silverlight: How to apply an effect to a user control

Hi there, I have a DataGrid and I need to apply an effect to a cell depending on the value of the cell. Not sure how to do it. I have the effect writen in code but am not sure not to apply it. What i want to end up with is myTextBlock.Effect = myDropShadowEffect; How can i achieve this? Do I first say If so, how do I define "MyEff...

How to pass messages from a child user-control to the parent

This is a Windows Forms / .Net C# question. I have a borderless windows whose transparency key and background color make it completely transparent. Inside the window are a couple of user controls. I want to be able to move the window. I know how to do this on the parent window, but my problem is that the child controls are the only t...

Static Members Issue - JasperReports for .Net over jni4Net

I'm trying to fill a report with empty datasource like this JasperPrint print = JasperFillManager.fillReport(@"D:\ImagesReport.jasper", null); Usually the program crashes without notice, but I used watch window and found that this is what I get at net.sf.jni4net.jni.JNIEnv.CallStaticObjectMethodPtr(Class clazz, MethodId methodIdNa...

Instance Members Issue - JasperReports for .Net over jni4Net

In JAVA you'd say : JRXhtmlExporter exporter = new JRXhtmlExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString()); But using jni4Net I cant find setParameter instance method (Note: It's inherited from JRAbstractExporter). I dont...

Finding a control on a Winforms using Linq?

I am trying to find an elegant way to get controls on a Winforms by name. For example: MyForm.GetControl "MyTextBox" ... But this has to make sure it goes through all the controls recursively. What's the most elegant way to implement this using Linq? ...

Emulating pass by ref in C++/CLI without using tracking reference (%)?

I want to emulate the following method: ref class Something{ void foo(array<double>^% data) { data = gcnew array<double>(10); } }; Such that, the caller's array gets modified/created. Nevertheless, there are some constrains: foo cannot use ref/out/% nor any additional parameters. the actual parameter of foo has to be ...

Why cant partial methods be public if the implementation is in the same assembly?

According to this http://msdn.microsoft.com/en-us/library/wa80x488.aspx "Partial methods are implicitly private" So you can have this // Definition in file1.cs partial void Method1(); // Implementation in file2.cs partial void Method1() { // method body } But you cant have this // Definition in file1.cs public partial void Metho...

Why doesn't c# support an object with an interface as a parameter?

I have the following class declaration: public class EntityTag : BaseEntity, ITaggable I have an Html helper method: public static string TagCloud(this HtmlHelper html, IQueryable<ITaggable> taggables, int numberOfStyleVariations, string divId) This is my ASP.NET MVC ascx: <%@ Control Language="C#" Inherits="System.Web.Mvc.View...

Best way to handle multiple config file instances?

We run a complex system written in C#.NET 3.5, consisting of 20+ websites, 10+ windows services and various scheduled tasks and helper apps. Each of these is bundled with one or more of our framework and business logic DLL's. These DLL's have extensive config settings, and this has turned into a nightmare where we're maintaining over ...

SQL Service Broker Success?

I am contemplating converting our internal application from MSMQ and WCF to SSB. We would like a more feature rich system with regards to our queuing. However, I am not seeing a lot of implementations or general information if SSB is in use with .Net. The SSB blog is not very active and I see few posts in general on implementation s...

DynamicProxy2 and Proxy Chaining

I have the need to proxy the property types of a proxy. So the case would be: I have interface IMyInterface: public interface IMyInterface { public String Name {get; set;} public Int Id {get;set;} } I can mock the interface just fine but I want to be able to mock, for instance, the Name property. I realize that String cannot ...

Choosing a test platform for .NET - MbUnit or the one by Microsoft?

I have chosen these two as primary candidates. My thinking goes like this: MbUnit has had a nice start and enjoys a smart, dedicated team of developers. MSFT has many resources and can compete with MbUnit easily if they choose to do so. Which one do you believe I should bet on? ...

How to let Server Notify Client Behind Firewall

I have the case where I have a public facing service sitting out on the internet and I would like the ability for the server to contact specifically design embedded devices that are sitting in normal home networks when required. I know that the devices can poll the server to get updates etc but 1) There will be a lag between when server...

File.Delete Not Deleting the File

I am trying to delete a file, but the following code doesn't do that. It doesn't throw an exception, but the file is still there. Is that possible? try { File.Delete(@"C:\File.txt"); } catch(Exception e) { Console.WriteLine(e); } If the file can't be deleted, the exception should print out, but it doesn't. Should this fail...