.net

Quickest way in C# to find a file in a directory with over 20,000 files

I have a job that runs every night to pull xml files from a directory that has over 20,000 subfolders under the root. Here is what the structure looks like: rootFolder/someFolder/someSubFolder/xml/myFile.xml rootFolder/someFolder/someSubFolder1/xml/myFile1.xml rootFolder/someFolder/someSubFolderN/xml/myFile2.xml rootFolder/someFolder1 ...

Odbc Paradox Driver WHERE clause Date

I am using an Odbc driver with Paradox. I have a table with a date in it. I am trying to query by the date in that column. I can't seem to get the where clause to work. I can get the record searching by ints, but I don't know how to use the date time. OdbcCommand comm= new OdbcCommand("SELECT * FROM [Journal] WHERE" + ...

Linq To Sql - Update a value when another value changes

With Linq To Sql - what is the best way to update the value of one table in a database when a value changes in a different table? For example in TableA, there is a column called DateModified. TableA has an association to TableB. Now I want to set the value of the DateModified field to the current date every time the record changes in ta...

Process Explorer - How does the dragabble crosshair work?

There is a feature in sysinternal's process explorer that allows a crosshair to be dragged from the application to a control in any other application you are running and highlights said control. Does anyone know how this was achieved or if there is a .NET/C++ library out there that can be reused? ...

Why is this code executing faster than expected?

I have this code: public void replay() { long previous = DateTime.Now.Ticks; for (int i = 0; i < 1000; i++) { Thread.Sleep(300); long cur = DateTime.Now.Ticks; Console.WriteLine(cur - previous); previous = cur; } } Which is invoked as a separate thread lik...

Invalid Digital Certificate

I'm attempting to add SSL to my server for sending customer details to a client. It appears to be working on the Server side with the digital certificate (.pfx) being loaded succesfully. The problem comes when I try to connect with the client. An AuthenticationException is thrown stating that the remote certificate is invalid. The cert...

Is there something wrong with my System.Xml.Linq library?

I'm trying to learn some Linq to XML stuff, and I came across the XPathSelectElement function in XElement. This function seems to do just what I need, but for some reason, I can't use it! Check out my code: XElement rootElement = XElement.Load(dataFile); XElement parentElement = rootElement.XPathSelectElement(xPath); ...

GlobalAssemblyInfo.cs and strong naming

I have a GlobalAssemblyInfo.cs file in the root of my solution, and I have something like the following entry in it to enable strong naming of my output assemblies. #pragma warning disable 1699 [assembly : AssemblyKeyFile("..\\keyfile.snk")] #pragma warning restore 1699 This approach has two drawbacks. Firstly, AssemblyKeyFileAttribut...

iManage ImportCmd launching new instance of Word.

I'm trying to save a Word document into iManage using ImportCmd from IMANEXTLib and I'm getting a new instance of Word every time I run it. I've saved the document to doc1.doc, and then: 'Connects to WorkSite Dim dmsConnection As IManage.IManDMS = New IManage.ManDMSClass() dmsConnection.ApplicationName = "My Application" ...

Grant private access attribute

What's the name of the attribute that you apply on an assembly to allow access from another assembly to private methods? Thanks! ...

Batch print Word documents .Net?

Is it possible to print a batch of Word documents all at one time via .Net (c# or VB, 2.0, 3.0, 3.5... language and framework above 2 doesn't matter to me)? For example, I've got a local directory that contains several word documents... I can iterate through the list and call the PrintOut() method, but I believe that sends several print...

LINQ Optimization Question

So I've been using LINQ for a while, and I have a question. I have a collection of objects. They fall into two categories based on their property values. I need to set a different property one way for one group, and one way for the other: foreach(MyItem currentItem in myItemCollection) { if (currentItem.myProp == "CATEGORY_ONE"...

Is there an easy way to parse a (lambda expression) string into an Action delegate?

I have a method that alters an "Account" object based on the action delegate passed into it: public static void AlterAccount(string AccountID, Action<Account> AccountAction) { Account someAccount = accountRepository.GetAccount(AccountID); AccountAction.Invoke(someAccount); someAccount.Save(); } This works as intended... AlterAc...

How to get text clicked from another program into your own textbox?

What I mean is how can I get text from another running active window. For example I have a program let's say word or msn. I am chatting with someone while my own program is running in the tray. I want to set a key let's say right click and ctrl to open up my program and get the word I clicked on. I am using C#. ...

How to extract an assembly from the GAC?

There is a package I have to deal with which installs assemblies straight into the GAC (e.g. somewhere deep in %windows%/assembly). How do I exorcise the actual assembly (the DLL) from the GAC into the normal file system? Thanks. ...

Re-learning C#

I recently applied for a C# junior programmer position and went through the initial phone screening, which I felt pretty good about. My current position is at a company that uses exclusively VB.NET development for .NET applications. I have worked with C# in college and some on my own after college and that is what I want to use for my ...

Compromised interoperability in .NET?

Recently I asked a question here about using F# extensions in C#. Brian quoted: Per the language spec, section 10.7 "Type extensions": Optional extension members are syntactic sugar for static members. Uses of optional extension members elaborate to calls to static members with encoded names where the object is passed as the fir...

Linq's OnValidate event doesn't get fired

I validate data for a table made in the linq designer in the event OnValidate. This event is fired when I insert records, but not is fired when I update records. I have this code: public bool Save(int id, string marca, string modelo, string año, string motor, bool disponible, RuleList issues) { Usado u; if (id == 0) { ...

GPS library for .NET compact framework

I'm thinking of writing simple application for Windows Mobile devices, where user could simply enter destination coordinates, and the app would calculate distance and show direction to the destination. But I haven't found any Free, preferably Open Source library with simple API to work with GPS. ...

Implementing ISupportErrorInfo on a C# object exposed to COM

I'm writing a COM object in C# and I'd like to raise errors to vba/asp client software using the mechanism it understands - the Err object. In good ol' days that would have meant implementing ISupportErrorInfo on the COM object but I can't find any information about how to implement that interface in a C# object. Can anybody help? tha...