.net

Wildcard filename in schema.ini?

Was wondering if there was a way to put a wildcard in the schema.ini for example [*.txt] FMT=TabDelimited I've got an app that is imported tab delimited files and the only place I can seem to get the FMT="TabDelimited" is in the schema.ini (doesn't work in the connection string for some reason), but I will have no idea what the filename...

How can I Trim the leading comma in my string.

I have a string that is like below. ,liger, unicorn, snipe in other languages I'm familiar with I can just do a string.trim(",") but how can I do that in c#? Thanks. There's been a lot of back and forth about the StartTrim function. As several have pointed out, the StartTrim doesn't affect the primary variable. However, given th...

How do I check for nulls in an '==' operator overload without infinite recursion?

The following will cause infinite recursion on the == operator overload method Foo foo1 = null; Foo foo2 = new Foo(); Assert.IsFalse(foo1 == foo2); public static bool operator ==(Foo foo1, Foo foo2) { if (foo1 == null) return foo2 == null; return foo1.Equals(foo2); } How do I check for nulls? ...

.NET Remoting exception

This is about when a .NET remoting exception is thrown. If you take a look at MSDN, it will mention that a remoting exception is thrown when something goes wrong with remoting. If my server is not running, I get a socket exception which is fine. What I am trying to figure out is: does getting a remoting exception indicate for sure that...

Translate C++/CLI to C#

I have a small to medium project that is in C++/CLI. I really hate the syntax extensions of C++/CLI and I would prefer to work in C#. Is there a tool that does a decent job of translating one to the other? EDIT: When I said Managed c++ before I apparently meant c++/CLI ...

String vs StringBuilder

I understand the difference between String and StringBuilder (StringBuilder being mutable) but is there a large performance difference between the two? The program I’m working on has a lot of case driven string appends (500+). Is using StringBuilder a better choice? ...

How do I embed Media Player in a C# MailMessage to play an Attachment

I'm using a C# MailMessage to attach a wave file (8K) to an email message. I'd like to provide a player within the body of that email message that will play that wave file if the user chooses to do so. I've tried using the embedded <object> version of WMP, and a cid: reference to the file, but Outlook 2003 rejects the object tag and wo...

Is it possible to base GroupTemplate (.NET) on anything but a fixed record count?

I'd like to use ListView to display grouped data from my db. Because of the way the query is structured, each logical group might have 1 or 2 records associated with it. Is there anyway to use GroupTemplate, while overridding the GroupItemCount behavior? Ideally, I'd like it to behave the way SQL does- assign a column ID, and let it watc...

Using DLR from Unmanaged Code

Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code such as C++ or Delphi? For example, we have an application written in Delphi that is being moved to C#.NET We'd like to provide Ruby or Python scripting in our new application to replace VBSCRIPT. However, we would need to provide Ruby/Python...

Résumé parsing library for a .Net project

I need to extract information from hundreds of résumés. The ideal would be .doc, .docx, .pdf, .rtf --> hr-xml but since more than 90% of the résumés are .doc, the other formats are not a must have. I'm looking to buy a third-party tool or a component. Do you have any good/bad experience solving a similar problem? Clarification: I'm ...

Redundant Call to Object.ToString()

I have a function that takes, amongst others, a parameter declared as int privateCount. When I want to call ToString() on this param, ReSharper greys it out and marks it as a redundant call. So, curious as I am, I remove the ToString(), and the code still builds! How can a C# compiler allow this, where str is a string? str += private...

What is the "best" canonical implementation of Equals() for reference types?

Implementing Equals() for reference types is harder than it seems. My current canonical implementation goes like this: public bool Equals( MyClass obj ) { // If both refer to the same reference they are equal. if( ReferenceEquals( obj, this ) ) return true; // If the other object is null they are not equal because in C# this ...

Rhino Mocks: What scope do actions inside Do() execute in?

I notice that if I write Expect.Call(delegate { obj.Method(null); }).IgnoreArguments().Do( new Action(() => {Console.Write("executed");throw new Exception(); })); Provided that the method does run, MbUnit will recieve the "executed" message but will not detect an exception being thrown. Does anyone know why that is so? Is this som...

XBAP Application, can these work in Google Chrome?

I'm developing a .NET 3.5 XBAP application that runs perfectly fine in FF3 and IE6/7 etc. I'm just wondering if its possible to get these to run under other browsers, specifically (as its in the limelight at the moment) Google Chrome. ...

Obtain parameter values from StackFrame in .NET?

I would like to be able to obtain all the parameter values from the StackFrame in .NET. A bit like how you're able to see the values in the CallStack when in the VS debugger. My approach has concentrated on using the StackFrame class and then to reflect over a ParamaterInfo array. I've had success with reflection and properties, but this...

How do you quickly find the URL for a .NET framework method on MSDN?

How to you find the URL that represents the documentation of a .NET framework method on the MSDN website? For example, I want to embed the URL for the .NET framework method into some comments in some code. The normal "mangled" URL that one gets searching MSDN isn't very friendly looking: http://msdn.microsoft.com/library/xd12z8ts.aspx....

How to make a Side-by-Side Compiler for .NET

Nikhil Kothari's Script# is quite possibly one of the most amazing concepts I've seen in the JavaScript arena for quite some time. This question isn't about JavaScript, but rather about language compilation in the .NET runtime. I've been rather interested in how, using the .NET platform, one can write a compiler for a language that alre...

NHibernate to not cache a property

How can I configure NHibernate to not cache a file. I know I can create a method that does an HSQL, but can I through a configuration setting in the .xml file or the hibernate xml file itself to not cache a property? Thanks in advance. ...

Initializing user.config or app.exe.config during install

I am developing a .NET WinForms application which relies on user.config to store various useful settings such as intranet web service URLs. We would like to make it possible to import custom initial settings as part of the installation. The use case for this is if a company has 100 machines they want to install the software on, and the...

Serializing SQL CE data to XML

I'm working on a product feature that will allow the user to export data from a SQL CE database on one copy of my application and re-import it into SQL CE on the other end. This data is not whole tables, but the result of queries. I had hoped to take advantage of .net's built-in XML-based serialization like in DataTable.WriteXML. But, n...