.net

Can LINQ do this for me?

Hi.. new with Linq and very excited with this feature. However, I want to see if I can do the following with LINQ: DataView source = (DataView) MyDataGrid.ItemsSource; foreach (DataRowView vw in source) { if (vw.Row[dummyColumnIndex] != null && vw.Row[dummyColumnIndex].ToString() == DisplayValue) { vw...

Checking whether an `object[] args` satisfies a Delegate instance?

I have the following method signature: public static void InvokeInFuture(Delegate method, params object[] args) { // ... } The delegate and the arguments are saved to a collection for future invoking. Is there any way i can check whether the arguments array satisfies the delegate requirements without invoking it? Thanks. EDIT: ...

Ghost-borders ('ringing') when resizing in GDI+

What happens (only noticeable on certain images) is I will see a 1 pixel white border that is inset one pixel. It seems to happen in areas that are light but not white (e.g. the sky). It is similar to when something is oversharpened and a ghost border can be seen next to high contrast edges. Here is the repro code that reproduces it per...

ClickOnce app does not start through Process.Start("x.abc") with *.abc associated to ClickOnce app

I have successfully developed and deployed a ClickOnce application which registers an associated file extension, for instance *.abc. When I click on a file named x.abc or if I type x.abc from the command prompt, the ClickOnce application starts and I can retrieve the file through the dedicated API. I can also launch the application progr...

Implementing an async WCF service

I have a WPF application which I'm currently working on separating into a client and server side - using WCF. I did not like the mess I initially got with the straight forward solution, so now I'm restructuring following the recommendations in the screencast of Miguel Castro, WCF Extreme. If you're not familiar with the video he basicall...

Can I embed other files in a DLL?

I'm writing a plug-in for another application through an API. The plug-ins are distributed a DLLs. Is it possible to embed other files in the DLL file like pdfs, images, chm help files etc... I want to be able to provide documentation with my plug-in but I'd still like to retain the ability to distribute the plug-in as a single file the ...

Messages via SOAP throws CommunicationException

This is how my service is set up: myServiceHost = new ServiceHost(typeof(ChatCommunicationService), new Uri("http://localhost:8080")); myServiceHost.AddServiceEndpoint(typeof(IChatService), new WSHttpBinding(), "Soap"); myServiceHost.Open(); This is how my webservice client is set up: ChannelFactory<IChatService> scf = new ChannelFac...

formating HTML content into a printable report

I have been using the AJAX html editor to create content for a .NET project. The content is stored as raw HTML mark-ups. Now I need to take that content and inject it into a printable format. I've tried report writers like Crystal Reports and/or ActiveReports. Both make references that it can consume HTML, but only a subset is processe...

.NET ReportViewer capabilities: Displaying multiple rows

Situation: We've designed a decent looking Report page using the .NET ReportViewer (ASP.NET, RDLC) with a custom object from our object model. My underlying (and possibly incorrect) assumption was that if we bound a collection of custom objects to the ReportViewer/RDLC, the control would build a populated report layout for each object ...

Getting the same element without changing it using Linq

I have a method like this: public List<Fruit> Traverse (IEnumerable<Fruit> collection, Action<Fruit> action) I can do this: Traverse (array, f => f.Text); How can I call the action so I get the same element? Traverse (array, f => f); C# compiler doesn't allow me to do this. EDIT: List<Fruit> result = ... foreach (Fruit fruit i...

Variable number of arguments without boxing the value-types?

public void DoSomething(params object[] args) { // ... } The problem with the above signature is that every value-type that will be passed to that method will be boxed implicitly, and this is serious performance issue for me. Is there a way to declear a method that accepts variable number of arguments without boxing the value-type...

Recommendations for C#-ish developer regarding smooth transistion to Android?

Hi there, finally my old Nokia broke down just hard enough to justify buying a new proper phone, an Android! In a way I'm glad it's taken me this long to obtain a "layman-hackable" phone; I doubt I could have resisted developing funny bits of this&thats on a smartphone with time needed spent elsewhere...(would have had mad skills in W...

Is there a way to reference the child of a WPF UI element by name?

I've got a very simple app.xaml.cs that, when the app starts up, creates a new PrimeWindow, and makes it accessible to the outside. public partial class App : Application { public static PrimeWindow AppPrimeWindow { get; set; } private void Application_Startup(object sender, StartupEventArgs e) { AppPrimeWindow = ne...

Custom attribute to switch property serialization to NetDataContractSerializer

In .NET 3.5, I would like to create a custom attribute (say [NetDataMember]) that would switch the serialization behavior from DataContractSerializer to NetDataContractSerializer. Basically, for a class A as illustrated below [DataContract] class A { [DataMember] public int SimpleProperty { get; set; } [Transcient] public IBar...

Using WiX to put an assembly into both the GAC and Install Path

I'm just starting to learn how to use WiX and I'm running into a snag. My package uses a third party library that requires some file to exist both in the GAC and the package installation directory. Using WiX, I can make files show up in the installation directory, or in the GAC, but not both. Is there any way to work around this? ...

Lightweight use of Enterprise Library TraceListeners

Is it possible to use the Enterprise Library 4.1 TraceListeners without using the entire Enterprise Library Logging AB? I'd prefer to simply use .NET Diagnostics Tracing, but would like to setup a listener that sends emails on Error events. I figured I could use the Enterprise Library EmailTraceListener. However, my initial attempts to c...

Why does AppDomain.Unload() error in finalizer?

Here's some sample code: using System; namespace UnloadFromFinalizer { class Program { static void Main(string[] args) { Program p = new Program(); } AppDomain domain; Program() { this.domain = AppDomain.CreateDomain("MyDomain"); } ~Program...

"FormatException was unhandled" Input string was not in a correct format.

Hi ! Here I am trying to write a function that returns me value based on the following condition... IF Variable is NULL return me DBNull.Value ELSE Convert Variable into DataType whose DataTypeCode has been provided to me as a parameter of function. eg. Now while converting a variable into required DataType, an exception is thrown...

Obtain Listing of all Fields in a Project

I have a relatively large solution that I compile to DLL. I would like to print out or list all the fields in every class in this project. I'm looking for a Visual Studio feature, Visual Studio add-on, external tool, script, or code snippet (something involving reflection, perhaps?) that will allow me to simply print out all these fie...

c# tool sn.exe: with the userlist argument and without the userlist argument

what is the difference of sn.exe -Vr between with the userlist argument and without the userlist argument? ...