.net

How can I rename files to a unique name that is fool proof in C#?

My app needs to copy/move thousands of files throughout the day to a directory. I need to ensure that when I copy over these files I rename them to something that is unique for that directory. I have no requirements for the names other than they need to obviously be unique. What is the proper way to handle this? Should I use some kin...

Possible to pass null from Powershell to a .Net API that expects a string?

API: namespace ClassLibrary1 { public class Class1 { public static string Test(string input) { if (input == null) return "It's null"; if (input == string.Empty) return "It's empty"; else return "Non-empty string of length " + inpu...

Is REXX available in .NET?

Is anyone aware of a REXX implementation for .NET? Or plans for one, perhaps using the DLR? ...

How to specify a collection in a custom configSection

I would like to have an xml config file as follows: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="plugins" type="MyApp.PluginsConfiguration, MyApp"/> </configSections> <plugins> <use assembly="MyApp.Plugin1.dll" /> <use assembly="MyApp.Plugin2.dll" /> </plugins> </configuration> H...

.NET: Combining two generic lists.

Let's say I have two generic lists of the same type. How do I combine them into one generic list of that type? ...

Notification on screen orientation change

Windows 7, .NET 3.5 I need to know when netbook (small laptop, but normal Windows 7) changes orientation (there is a button on the netbook that is used to switch landscape/portrait orientation). This tells me the orientation, but I am looking for the change notification event: System.Windows.Forms.SystemInformation.ScreenOrientation ...

How do I copy a chart image to the clipboard using C#2010?

I am learning C# as I write a program which interfaces with a spectrometer. I have figured out how to get a spectrum from the spectrometer and plot it on an MS chart. How do I copy the image of the chart into the clipboard so that it can be pasted into other programs? I'm using Visual Studio C# 2010. I have found the chart.SaveImage ...

Find DNS HostName from IP Address in LAN

Hey all. I have written a program that sequentially scans certain parts of a LAN for computers (code will be provided). However, when I run this code, it only returns the DNS HostName of the computer it is running on. I looked into using WMI, but I cannot, as I will not always have priveleges to the computers being found. Is there any ot...

Execute a one-way wcf service operation from powershell

I have a scheduled task which executes a powershell script every hour. The powershell script must make a call to a one-way WCF service operation. Essentially it just needs to kick off an operation. My question is how do i go about doing that? I thought that just executing the url would in fact kick off the request but apparently that...

splitting a string value c#

Hi, I have a string value and wish to get the engineers name only e.g. in this case "CARL HARRISON". "{ Engineer = CARL HARRISON, HandHeldAvailability = H, HASHHT = True, HHTSTATUS = }" The names can be diffrent lenths but will alway be in the same format. ...

How to convert List<Company> to List<ICompany>

Hi I would like to convert List<Company> to List<ICompany> ICompany is an interface which Company implements. public List<ICompany> FindAll() { List<Company> companies = new List<Company>(); var query = from c in _scope.Extent<Company>() select c; companies = query.ToList(); return companies.ToList<I...

Code Access Security / Permission issue with executing custom assembly from SSRS 2008 report

Hi I have created a dll consisting of a class and a static function to fetch attachments from TFS database. Below is the static function public static List<string> GetAttachments(int workItemId) { string tfsReportServerUrl = "http://&lt;&lt;ServerName&gt;&gt;:8080/"; List<String> files = new List<strin...

.net reversing byte order?

In the code below, why do X and Y take on different values than what I would think intuitively? If the bytes 0-7 are written to the buffer, shouldn't the resulting long have bytes in the same order? It's like it's reading the long values in reverse order. x 0x0706050403020100 long y 0x0706050403020100 long z 0x0001020304050607...

Speeding up cross-AppDomain communication

I am trying to execute some logic on multiple AppDomains in parallel. I am doing this because I am working with legacy code which is "un-changeable" and I want to improve performance by parallelizing some things. The problem is that if I run multiple instances within 1 AppDomain they all rely on some static data structures and interfer...

OutOfMemoryException when I hit 1GB

Does anyone know why I would get an OutOfMemoryException when TaskMgr.exe says my process is only taking up ~1GB of memory? ...

How to start a 64-bit process from a 32-bit process

I am trying to run a 64 bit executable (java.exe) from our 32-bit .NET application. I am using Process class and invoking cmd /c <command name> in order to support all possible commands (like dir, cd etc). The problem is that on my machine I installed 64-bit version of JRE and java.exe is only available from C:\Windows\System32 folder (...

System.Speech.Synthesis and Windows Server 2003

Has anyone got System.Speech.Synthesis work on Windows Server 2003? I have a simple TTS that works on XP, but on Windows Server 2003, I get the system.invalidoperation exception. I hope the solution is not to use the Voice Server. EDIT: Anyone? Any help? Please? ...

For developers, is it worth it to learn/use SSIS?

I'm starting to get involved in quite a bit of ETL work a my current job, and everyone seems to be pretty partial to SSIS. I'm struggling trying to do the most trivial transformations through BI studio that would usually equate to a couple foreach loops with a pinch of LINQ. Im not sure of the use cases or users this tool would be usef...

Excel/Visual Studio/C#. How to change the display name of a cell but keep the formula

Hi there, I have some code that those: void mActiveSheet_Change(Microsoft.Office.Interop.Excel.Range Target) { if (Target.Cells.Formula.ToString().StartsWith("=FR(")) .... } So whenever someone uses my custom function "=FR" I can handle it. That's fine but while the formula value for that cell ...

Cleaning up after calling GetSystemMenu()

I'm using Florian's wrapper class to call GetSystemMenu() to add a custom menu item to the system menu for an application. I'm just curious as to whether there is any cleanup required for the handle returned by calling GetSystemMenu or the additional menu items. I don't see any mention of needing to call CloseHandle() or similar, so my ...