.net

Editing WinForms RichTextBoxControl C#

How can you add text to a RichTextBox control and change the font style as you add text? ...

Strange crash when loading a C DLL compiled with GCC in cygwin into a C#.NET application

I try to load a simple DLL compiled with GCC in cygwin into a C#.NET application. The DLL looks like this #ifndef __FOO_H #define __FOO_H #if _WIN32 #define EXPORT extern "C" __declspec(dllexport) #else //__GNUC__ >= 4 #define EXPORT extern "C" __attribute__((visibility("default"))) #endif EXPORT int bar(); #endif // __FOO_H T...

Xml serialization. Deserialize and convert to a different object.

I have class: public class MyClass { [XmlElement("Date")] public DateTime Date { get; set; } } It was XML serialized to a file: var myClass = new MyClass() { Date = new DateTime(2010, 09, 24) }; new XmlSerializer(typeof(MyClass)).Serialize(fileStream, myClass); The result: <MyClass> <Date>2010-09-24T00:00:00</Date> </M...

How do I instantiate a class that only has a private parameterless constructor in Silverlight?

I'm working on a feature request for a .NET test data builder. I need to be able to instantiate classes that only have private parameterless constructors. For instance, I might need to instantiate the following class: public class MyClass() { private MyClass(){} } For most other classes I use the following code: (T)Activator.Cr...

Accurately measure elapsed wall clock time in .NET

What is the most convenient way of accurately measuring elapsed wall clock time in .NET? I'm looking for something with microsecond accuracy if possible (10^-6 seconds). ...

What happens when starting a .NET console application?

What exactly happens when a .NET console application starts? In the process explorer, when starting the exe I am wondering why I cannot see a "cmd.exe" process as a parent process for the console application. What exactly is displayed then? Is there a way to replace the "default" console window by another one? I guess this would mean m...

Multiplication with .NET regular expressions

In the spirit of polygenelubricants' efforts to do silly things with regular expressions, I currently try to get the .NET regex engine to multiplicate for me. This has, of course, no practical value and is meant as a purely theoretical exercise. So far, I've arrived at this monster, that should check if the number of 1s multiplied by t...

StructureMap IOC named instances help.

Hi, Having a problem with StructureMap IOC. I wish to retrieve different concrete implementations of objects that implement the same interface based on labels or names. internal static class InstanceHelper { internal enum Taxonomy { Foo, Bar } static InstanceHelper() { // Initialize th...

Master and content page in asp.net?

Hi, In my web application i am using master page concept, In master page i have login panel using this user can login, after login login panel will not visible and a link button will visible as logout, it is working fine but in one of child pages (content page) i have login panel for login which is in update panel, when user login succ...

commercial IDE for crossdevelopment arm chips

Hi fellas, for now i use eclipse on windows and codesourcery compiler to crosscompile c applications for my AT91SAM9RL-EK board. I am thinking of getting a commercial IDE for crossdevelopment for c / c# / .net on arm. Has anyone experience with commercial products for arm development? ...

How to validate an XPS document?

Is there any C# API to validate a generated XPS document? (i.e. to make sure the file is a valid xps file) ...

How do I get MEF to recompose when I change a part?

I am trying to get MEF to recompose all the parts that it knows about when I update an instance that is exported. Essentially I want to have MEF update all my parts that import a connection string configuration value when it is changed. Everything looks good up to the point where I want to change the instance. If I try to ComposeParts wi...

How to use javascript in .ascx pages

How to use javascript in .ascx pages ...

How do I set up a WCF service and MVC site to share the same SSL certificate?

Hello, I have two projects, one is a WCF service, the other is an ASP.NET MVC site. The service is to be exposed to multiple consumers, including my MVC site. Both the site and the service require access over SSL. I only have one SSL certificate I can use. Any ideas how I can set these two projects up in IIS? Thanks in advance. ...

C# Generics with IronPython Type Parameters

So, the situation is I have a C# generic class named Foo with a template parameter T which has the new() constraint. I've declared my classes something like this: class Baz { public Baz() { } } class Foo<T> where T : Baz, new() { // blah blah } And in Python: class Bar(Baz): def __init__(self): """ do various...

.NET (C# ) Install Project. Including other packages problem

Hi, folks. I've created a setup project in VS2008 which installs fine by itself. However projects being installed by this installer depend on components (mainly speaking ESRI) which must also be installed on target machines. There is a separate installer for ESRI that we have and it consists of msi srcipt as well as 6 folders with subfol...

Windows Workflows & Global events

I'm relatively new to using Windows Workflow but we have a requirement whereby all currently active workflows undertake an action based upon a "global event" rather than an event based upon a single instance. e.g. you could have a workflow which is used for the submission and tracking of tickets, with the scenario that when the support ...

Clone a list of reference types that CANNOT implement ICloneable

Is there an easier/tidier way to deep clone a list of reference types that do not implement ICloneable. Currently have been looping through each object in the list like so: Dim myListCopy As New List(Of ListObj) For Each lo As ListObj In MyList myListCopy.Add(lo.ShallowCopy) Next The object ListObj contains only v...

How to get a resource from a merged ResourceDictionary in a code-behind file?

I have a custom look-less control derived from Control class. It's template is defined in Generic.xaml file. Now I want to add some UI stuff to it (mostly brushes) and want to do that in separate resource dictionary, and then access those stuff from the code-behind feil (*.xaml.cs). See bellow: Generic.xaml (fragment): <ResourceDiction...

Writing embedded javascript code to c# .net

i have the js file how can i add that in winform C#, i have developed the front-end and i want to run the js file on button click. i will be thankful to u if u provide the snippet!!!!! I want to run javascript code in windows form thank you. ...