a few years ago, I remember reading a book which described how you could override the default event 'dispatcher' implementation in .NET with your own processor.
class foo {
public event EventHandler myEvent;
...
}
...
myFoo.myEvent += myBar1.EventHandler;
myFoo.myEvent += myBar2.EventHandler;
Whenever the event fires, both...
I am using Log4Net with the AdoNetAppender to log messages from a simple systray application into a SQL Server 2005 database.
I want to log the machine name along with the log message because this application will be running on multiple machines and I need to know on which one the message originated.
But, I cannot find a way to expose ...
Can you package up the .Net framework in an installer created in Visual Studio? If so how?
I've seen this done with Install4J packaging a JVM but I think that was the JVM to run Install4J.
...
Let's say you have a class with a Uri property. Is there any way to get that property to accept both a string value and a Uri? How would you build it?
I'd like to be able to do something like one of the following, but neither are supported (using VB, since it lets you specify type in the Set declaration for the 2nd one):
Class MyClas...
Given the following C function in a DLL:
char * GetDir(char* path );
How would you P/Invoke this function into C# and marshal the char * properly.
.NET seems to know how to do LPCTSTR but when I can't figure out any marshaling that doesn't cause a NotSupportedException to fire when calling this function.
...
I have a class that looks like this
public class SomeClass
{
public SomeChildClass[] childArray;
}
which will output XML from the XMLSerializer like this:
<SomeClass>
<SomeChildClass>
...
</SomeChildClass>
<SomeChildClass>
...
</SomeChildClass>
</SomeClass>
But I want the XML to look like this:
<SomeCla...
I'd like to do some basic profiling of my code, but found that the DateTime.Now in C# only have a resolution of about 16 ms. There must be better time keeping constructs that I haven't yet found.
...
Is there any way for the main form to be able to intercept events firing on a subcontrol on a user control?
I've got a custom user-control embedded in the main Form of my application. The control contains various subcontrols that manipulate data, which itself is displayed by other controls on the main form. What I'd like is if the mai...
I am trying to use the Directory.GetFiles() method to retrieve a list of files of multiple types, such as mp3's and jpg's. I have tried both of the following with no luck:
Directory.GetFiles("C:\\path", "*.mp3|*.jpg", SearchOption.AllDirectories);
Directory.GetFiles("C:\\path", "*.mp3;*.jpg", SearchOption.AllDirectories);
Is there a ...
I need to call a method that accepts a stream argument. The method loads text into the stream, which would normally be a file. I'd like to simply populate a string with the contents of the stream, instead of writing it to a file. How do I do this?
...
We are build a website using MVC pattern. So far all the pages we built used models which had to operate on Reference data(which is cached when the website loads for the first time).
But now we have reached that stage of the flow where we have to deal with Transactional data (which is specific to that flow). Till now we created model cla...
Using C# .NET 2.0, I have an owner-drawn ListView where I'm overriding the OnDrawColumnHeader, OnDrawItem and OnDrawSubitem events. If I set the View property to Details at design-time, everything works beautifully and I can switch the View property and all view modes display as they should (I'm not using Tile view). However, if I star...
I'm trying to debug an MSBuild task, and I know there is some way to write to the MSBuild log from within a custom task but I forget how.
...
Is there a max length that a stream writer can write out to a file?
Or is there a max length that WriteLine() can output?
I am trying to write some data to a file but all of the data does not seem to make it.
Thank you for the help
...
Hi,
I'm looking for some kind of text-parser for ASP.NET that can make HTML from some style of text that uses a special format. Like in Wiki's there is some special syntax for headings and such. I have tried to look on google, but I did not found anything for .NET.
Do someone know about a library for .NET that can parse the text to HTM...
In .net, I have an inherited control:
public CustomComboBox : ComboBox
I simply want to change the default value of DropDownStyle property, to another value (ComboBoxStyle.DropDownList) besides the default one specified in the base class (ComboBoxStyle.DropDown).
One might think that you can just add the constructor:
public CustomCo...
I frequently need to debug .NET binaries on test machines (by test-machine, I mean that the machine doesn't have Visual Studio installed on it, it's frequently re-imaged, It's not the same machine that I do my development on, etc).
I love the Visual Studio debugger, but it's not practical for me to install visual studios on a freshly i...
I can't figure out how to compile thrift files for C#. I've read, "thrift files which can then be compiled down to language-specific interfaces for a wide variety of different programming platforms (Java, PHP, C/C++, Cocoa, Perl, C#, Ruby, etc.)."
I was looking here: http://www.markhneedham.com/blog/2008/08/29/c-thrift-examples/ and it'...
What would you recommend for class that needs to keep a list of unique integers?
I'm going to want to Add() integers to the collection and also check for existence e.g. Contains().
Would be nice to also get them in a list as a string for display, ie. "1, 5, 10, 21".
...
I would like to override the use of the standard app.config by passing a command line parameter. How do I change the default application configuration file so that when I access ConfigurationManager.AppSettings I am accessing the config file specified on the command line?
Edit:
It turns out that the correct way to load a config file t...