.net

How can I programmatically determine if I have write privileges using C# in .Net?

How can I determine if I have write permission on a remote machine in my intranet using C# in .Net? ...

What's the best way to read and parse a large text file over the network?

I have a problem which requires me to parse several log files from a remote machine. There are a few complications: 1) The file may be in use 2) The files can be quite large (100mb+) 3) Each entry may be multi-line To solve the in-use issue, I need to copy it first. I'm currently copying it directly from the remote machine to the local ...

How can I determine if a remote drive has enough space to write a file using C#?

How can I determine if a remote drive has enough space for me to upload a given file using C# in .Net? ...

What is the best way to read GetResponseStream() ?

What is the best way to read an HTTP response from GetResponseStream ? Currently I'm using the following approach. Using SReader As StreamReader = New StreamReader(HttpRes.GetResponseStream) SourceCode = SReader.ReadToEnd() End Using I'm not quite sure if this is the most effecient way to read an http response. I need the output ...

Is there any way in .NET to programmatically listen to HTTP traffic?

I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy for the browser to use in order to see what its sending? I'm already using Fiddler to watch the traffic but I want somethi...

What should I do to keep a tiny Open Source project active and sustainable?

A couple of months ago I've coded a tiny tool that we needed at work for a specific task, and I've decided to share it on CodePlex. It's written in C# and honestly it's not big deal but since it's the first project I've ever built from scratch in that language and with the goal of opening it from the very beginning, one ends getting sort...

How do I obtain the size of a folder?

I'm converting an old app that records folder sizes on a daily basis. The legacy app uses the Scripting.FileSystemObject library: Set fso = CreateObject("Scripting.FileSystemObject") Set folderObject = fso.GetFolder(folder) size = folderObject.Size There isn't an equivalent mechanism on the System.IO.Directory and System.IO.DirectoryI...

Is there any way in .NET to programmatically listen to HTTP traffic?

I'm using browser automation for testing web sites but I need to verify HTTP requests from the browser (i.e., images, external scripts, XmlHttpRequest objects). Is there a way to programmatically instantiate a proxy or packet sniffer for the browser to use in order to see what its sending? I'm already using Fiddler to watch the traffic ...

How do I automate a web proxy in .NET for unit tests (including set up and tear down)?

Following Jonathan Holland's suggestion in his comment for my previous question: Is there any way in .NET to programmatically listen to HTTP traffic? I've made a separate (but not exactly a duplicate) question for what I really want to know: How do I automate a web proxy in .NET for unit tests (including set up and tear down) for spying...

Redundancy in C#?

Take the following snippet: List<int> distances = new List<int>(); Was the redundancy intended by the language designers? If so, why? ...

What does the "private" modifier do?

Considering "private" is the default access modifier for class Members, why is the keyword even needed? ...

Is x86 assembler via .NET possible?

Is there such a thing as an x86 assembler that I can call through C#? I want to be able to pass x86 instructions as a string and get a byte array back. If one doesn't exist, how can I make my own? To be clear - I don't want to call assembly code from C# - I just want to be able to assemble code from instructions and get the machine code...

Is it ok to call a virtual method from Dispose or a destructor?

I can't find a reference to it but I remember reading that it wasn't a good idea to call virtual (polymorphic) methods within a destructor or the Dispose() method of IDisposable. Is this true and if so can someone explain why? ...

IoC Containers - Which is best? (.Net)

I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc. What are some of the differences amongst those mentioned (and any I neglected). Strengths? Weaknesses? Better fit (like StructureMap is great for ABC but...

C# 3 new feature posts (and not about .Net 3.5 features)

There are a lot of new features that came with the .Net Framework 3.5. Most of the posts and info on the subject list stuff about new 3.5 features and C# 3 changes at the same time. But C# 3 can be used without .Net 3.5. Does anyone know of a good post describing the changes to the language? (Besides the boring, explicit official specs a...

SQL tracing LINQ to Entities

So, I would like to know oh to do a "full" tracing of Linq to Entities? In other words: I already know about the ToTraceString() method, but this only works on an ObjectQuery. I need it to work on on the entire Linq layer... so when I am doing IQueryable "Where" expressions and additional filtering that I can see the entire query, not ...

MDIParent Tiling children

Is there any way to tile all of the form children of an mdi parent easily? I'm looking for most of the functionality that windows offers, tile cascade. Anyone know of an easy way? ...

What is the best data structure in .NET for look-up by string key or numeric index?

I'm looking for the most ideal data structure (for performance and ease of use) from which values can be retrieved by string key or index. Dictionary doesn't work because you can't really retrieve by index. Any ideas? ...

Can Windows PE 2.0 support the .Net framework?

I'm interested in building a PC for a car that will boot off of a USB Flash Drive. I'm planning on using Windows PE 2.0 for it with the GUI being written in c# or vb.net. Obviously, for this to work, I'd need to have .Net 2.0 or later installed. Understanding that .Net is not included by default, is there a way to package .Net 2.0 with ...

Find the next TCP port in .Net

I want to create a new net.tcp://localhost:x/Service endpoint for a WCF service call, with a dynamically assigned new open tcp port. I know that TcpClient will assign a new client side port when I open a connection to a given server. Is there a simple way to find the next open TCP port in .Net? I need the actual number, so that I can ...