.net

Is there any way to make a yield created Iterator Continue to the next item upon an Exception?

Hello Is there any way to have a yield created iterator continue to the next item when an exception occurs inside one of the iterator blocks? This is currently not working: Boolean result; while (true) { try { result = enumerator.MoveNext(); //Taken from a yield created e...

.net 2.0: What's the best way to deal with in-memory DataTables?

Hi, I have a csv file that I import into a DataTable. Furthermore I've created a TableAdapter with several queries. Is it somehow possible to execute the queries associated with the TableAdapter directly on the "in-memory" DataTable (doesn't seem so) or do I always have to write the imported DataTable to the database first and then exec...

Using C++\C# .Net assemblies\DLL's in win32 C++ (unmanaged) application

There is any way to use C++\C# .Net assemblies\DLL's in win32 C++ (unmanaged) applications? ...

Cross-domain AJAX using jsonp and .NET Web Service over SSL/HTTPS

Hello, I am using the example below to do a cross-domain ajax call using .net web services and jquery. http://bloggingabout.net/blogs/adelkhalil/archive/2009/08/14/cross-domain-jsonp-with-jquery-call-step-by-step-guide.aspx It works fine until I try to change my endpoint to https. I don't get any errors, just no response. My first qu...

How to Trace via category?

.NET lets you add trace statements to code. You can use Trace.WriteLine"(Some message"); and then define a trace listener to collect those messages to a log file. OK so far. But you can also do: Trace.WriteLine"(Some message", "Category"); How can you set up a filter in app.config (ie .exe.config) so that only messages with a cer...

RemoveHandlers on the base form

I wonder if I can remove all added event handlers in all the child forms from the one base form in the Closing method. (VB.NET; .NET 2.0) Background: In a project I analyze a memory problem. I verified with the memory profile (see related question) and find out that some forms are not collected by the GC, probably because of the EventH...

What does MethodImplOptions.Synchronized do?

Is the code below [MethodImpl(MethodImplOptions.Synchronized)] public void Method() { MethodImpl(); } same as public void Method() { lock(this) { MethodImpl(); } } ...

Is an in depth knowledge of IL important for .net development

When I did mostly c++ I though it was critical to know assembly and wrote some non trial asm code just so that I could truly understand what was going on. I now do mostly .net and while I have some understanding of IL I am by no means proficient. Is IL a skill that one should have a knowledge of or will learning IL more completely go ...

what's a good enterprise document generation solution? (SQL Server, .NET)

I wonder what "the big guys" use to generate documents. Like credit card statements, insurance documentation, etc. We're investigating changing solutions. Here are the two that I know of: SSRS Crystal Reports Neither of these seem to be able to handle widow/orphan control well. Crystal certainly can't deal with dynamically sized p...

How to tell if Type A is implicitly convertible to Type B

Given Type a and Type b, how can I, at runtime, determine whether there's an implicit conversion from a to b? If that doesn't make sense, consider the following method: public PropertyInfo GetCompatibleProperty<T>(object instance, string propertyName) { var property = instance.GetType().GetProperty(propertyName); bool isCompatib...

Possible to Change TextBox Style When Input Changes? (Stylesheet/Macro?)

Is it possible to create a macro or stylesheet so that when a TextBox text area is empty, it is yellow per se and when it has data it is white. I would like to accomplish this without having to explicitly call the TextChanged event. ...

Pop out menu for any control?

I have a couple places where a menu would be a better choice than display a dialog box and asked the user a question. Problem is I don't know how to do this. Here's the scenario: Current Situation: I have a picture box that is functioning like a button. The user clicks on the box and a dialog box pops up asking them to select a categor...

.NET ListView column order problem

I have a problem in a form, where I've added columns to a .NET ListView control, in the following order: A | B | C | D The display index for columns A-D is 0-3, in that order, yet they display in the wrong order: A | B | D | C ^-----^ these are switched at runtime Note: Everything looks as I want it at desi...

Why does calling a DynamicMethod with an instance of my own class cause an exception?

I'm learning CIL by making my own functions at runtime with Reflection.Emit. I'm actually surprised how easy things have been up until now but I've hit something that I can't guess my way through and I can't find anything relative in the docs. I'm trying to create a function that simply prints a very simple class I have defined. If I ch...

Using Extension Methods from within an Object's constructor where "Me" is the ByRef target object.

Consider the following: Public Module Extensions <Extension()> _ Public Sub Initialize(ByRef Target as SomeClass, ByVal SomeParam as Something ) ... Target = SomethingElse end Sub End Module Class SomeClass ... sub New(ByVal SomeParam as Something ) Me.Initialize(SomeParam) end sub sub ...

ADO.NET Entity Framework ObjectContext - Caching Question

I was wondering if it was wise to cache the Entity Framework's ObjectContext object in the Cache; will this give me issues with multiple connections at the same time that the user will experience issues with that? I've gotten errors like: 'connection is currently closed' and wondered if that was due to multiple users and caching the Obj...

Why is File.Exists() much slower when the file does not exist?

Seems to me that File.Exists() is much slower when the file does not exist or the use doesn't have access than when the file does exist? This doesn't make sense to me. ...

Is there a WPF control which will show a list of files in an Explorer-like view?

I often need to display a list of files to the user, say, as a result of a search query. Typically I describe my own simple DataTemplate for FileInfo. But I'm lazy to re-implement all the Explorer's functionality: the Views, Sorting, Context Menus and drag&drop. I feel like the problem is common and someone has already assembled a go...

How to set a viewable area for a WPF Line Series Chart

Hi I'm using the .NET Data Visualization Toolkit to create charts in WPF. My application basically adds a new value to the chart every second and redraw the chart. The problem is that I only want to display 100 points on the x-axis at any given time but the chart seems to redraw itself with all the values. Is there a way to display a ...

CLR JIT optimizations violates causality?

I was writing an instructive example for a colleague to show him why testing floats for equality is often a bad idea. The example I went with was adding .1 ten times, and comparing against 1.0 (the one I was shown in my introductory numerical class). I was surprised to find that the two results were equal (code + output). float @float =...