.net

Use a MemoryStream with a function that expects a Filestream

I have some functions here that for example are defined as private int WriteLogikParameterTyp(FileStream filestream) which i can not change. I want them to write into a MemoryStream Object. Is this possible? ...

Memory layout of a .NET array

What is the memory layout of a .NET array? Take for instance this array: Int32[] x = new Int32[10]; I understand that the bulk of the array is like this: 0000111122223333444455556666777788889999 Where each character is one byte, and the digits corresponds to indices into the array. Additionally, I know that there is a type refere...

WebService and Polling

Hi, I'd like to implement a WebService containing a method whose reply will be delayed for less than 1 second to about an hour (it depends if the data is already cached or neeeds to be fetched). Basically my question is what would be the best way to implement this if you are only able to connect from the client to the WebService (no no...

how to modify source with NAnt?

Hi, I would like to modify the string in a .h file with NAnt before building the solution. There is a macro in .h file: #define SERVER_ADDRESS "www.customserver.net" and I would like to modify the string before deploying software so each build could be made for custom address by passing the address in command line. Does anyone know ho...

How do I format the tooltip used by a DataGridView in virtual mode?

I need to apply formatting - specifically, bold text - to the tooltip used by a DataGridView in virtual mode. I can set the text in the CellToolTipTextNeeded event, but it doesn't support HTML tags; is there some other syntax I should be using? I don't want to have to reimplement tooltip support myself. ...

How to handle connections in data access layer ( .net )

Hi I am writing a data access layer. I am confused about managing connections in the system. I know that .net uses connection pooling. But I do not want to open and close database connections in all dml operations or in all sql query's. How can I handle this? Where and when ( maybe in global asax which uses data access layer or in the da...

Process Kill during execution of Nunit tests

I have a test project that takes alot of time to test cases. I have configured cruisecontrol.net with Nunit, msbuild. Now if I run my project during the execution of Nunit it kills the process and fail the build. Also if you force a build then results are not updated it shows the last build results and also giving Textfixturesetup failed...

How do I suspend painting for a control and its children?

I have a control which I have to make large modifications to. I'd like to completely prevent it from redrawing while I do that - SuspendLayout and ResumeLayout aren't enough. How do I suspend painting for a control and its children? ...

Rake for .NET

What is the best way to build a .NET solution and run MbUnit tests using Rake? I'm currently invoking commands directly like this: sh "#{DOT_NET_PATH}msbuild.exe /p:Configuration=#{CONFIG} #{SOLUTION}" This works but seems a bit rubbish. Are there any gems people would recommend using? ...

How to iterate on the objects present in the .NET managed heap?

Is there a way in the .NET API to iterate on the managed objects present in the managed heap? We would like to add a routine at some points in our program which checks the presence of some objects in the managed heap. ...

Is it possible to return interfaces from .net webservices or can one only return concrete classes?

I need to return a complex type from a webservice and had constructed the class MyComplexType which implements the interface IMyComplexType. Now in my webservice I have a method that should return an object that implements IMyComplexType like so: [WebMethod] public IMyComplexType GetMyComplexType() { IMyComplexType myCt = new MyCompl...

XSLT transformation datetime to date format

I'm trying to transform a datetime to a date format yyyy-MM-dd, because I'm using the xsd.exe tool the xs:date datatypes are automatically changed into a datetime datatype, because there is no type in the .NET Framework that matches the type xs:date completely. But I can't get it to work <articles> <article> <articlei...

Error with Html.RouteLink in ASP.NET MVC RC

I was using Html.RouteLink("LINKTEXT","RouteName",new RouteValueDictionary()) in asp.net MVC beta without problem, today I upgrade to ASP.NET MVC RC and this does no create the link anymore. The route still works because I type in the browser and I go to the Page I want. Any help? ...

Allow user to sort columns from a LINQ query in a DataGridView

Hi there I can't quite work out how to allow a DataGridView populated at runtime to sort (when users click on the column headers) where a LINQ from XML query is the DataSource, via a BindingSource. Dim QueryReOrder = From Q In Query _ Where ((0 - Q.Qualifier) / cmbTSStakeValue.Text) <= 0.1 _ ...

Setup project not installing referenced project content files

I have a Windows Service project, A, with a dependency on a class library project, B. Project B has XML files set as Content, Copy if newer. In the bin\Debug folder of project A, these content files are successfully copied. Edit (more failure): The Primary output installs fine. I cannot get the Content Files to install. Edit (win): I...

Appropriate implementation of IDisposable with Silverlight?

I'm working on a Silverlight app using the MVVM pattern. My ViewModel currently consists of a property that represents a collection of Model Objects: public ObservableCollection<IndexEntry> IndexList { get; set; } it also has several methods that will populate that collection with data that comes back from a web...

SIP/SIMPLE Client for .net (MSN Messenger)

I would like to create a small "Windows Messenger" Client that I can trigger from a script (essentially a notification Bot). It's internal, so I think it uses SIP or SIMPLE against a Live Communications Server 2005. Now, before I dig through the RFC's and Wireshark logs, I wonder if there is a .net Library already available that does th...

Is there any way for an App.config file to reference another full config file? (.NET)

Update: this question, including the title, was rephrased, see history for details I know that the following App.config includes a external file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings configSource="appSettings.config"/> <system.net> <connectionManagement> <add address="*" maxconnection="50...

What tools and techniques can I use to detect and isolate high memory usage in .NET applications which call into significant unmanaged code?

Suppose I have a WinForms .NET application written in C#. This application allocates large amounts of memory from both the managed and unmanaged heaps. I can (relatively) easily figure out the allocation details (who, when, how much, etc.) of the managed objects using tools like Red Gate ANTS Profiler (which I have not used) or JetBrai...

C# constructors with same parameter signatures

I'm sure this must be a common problem. I've got a class that in an ideal world would have the following constructors public Thing(string connectionString) public Thing(string fileName) Obviously this isn't allowed because the signatures are the same. Does anybody know of an elegant solution to this problem? ...