.net

How can I clone FileStream type?

How can I clone FileStream type? The problem is that I using MagickNet.Image(inputStream) to get the image distentions before saving it, but it seems to closing the inputStream. So, I can send a clone of inputStream to the function, so the function cannot edit the real inputStream object? This is my function: public Picture GetPictur...

Keeping VB.NET vs learning C++

EDITED... I posted a similar question about VB and C#. The question here is slightly different, considering the differences between VB.NET and C++ are greater than those between VB.NET and C#. Do I stick with my sort-of working knowledge of VB.NET and learn it thoroughly or skip to C++? EDIT 2: I am familiar with Actionscript syntax...

Creating T4 templates at runtime (build-time)?

We are building an inhouse application which needs to generate HTML files for upload into eBay listings. We are looking to use a template engine to generate the HTML files based on database and static fields that we have pre-defined. The template also needs to have logic capabilities (if-then, foreach, etc). We have looked at T4 and it ...

Check output size using .NET XmlTextWriter

I need to generate an XML file and i need to stick as much data into it as possible BUT there is a filesize limit. So i need to keep inserting data until something says no more. How do i figure out the XML file size without repeatably writing it to file? ...

How to prevent a form to show up in the constructor?

I have a C# application and I am trying to prevent a form to show up in the constructor. I launch the form like this: Form1 f = new Form1(); f.ShowDialog(); what do I have to do in the Constructor so the f.ShowDialog should not launch and continue code execution. ...

Silverlight, dealing with Async calls

Hi there, I have some code as below: foreach (var position in mAllPositions) { DoAsyncCall(position); } //I want to execute code here after each Async call has finished So how can I do the above? I could do something like: while (count < mAllPositions.Count) { //R...

Why does SubSonic 2.0 use System.Data.SQLite version 1.0.60.0?

Anyone know why Subsonic 2.2 uses System.Data.SQLite version 1.0.60.0 instead of the latest version 1.0.65.0? ie is it just because that's when it was released or is there anything in the newer version that doesn't work with SubSonic? What does everyone else use - do you just recompile from the latest branch of SubSonic using the lates...

How to get files from 1 to n in a particular pattern?

Suppose you have files like: NewFile.part01.zip NewFile.part02.zip NewFile.part04.zip NewFile.part06.zip NewFile.part07.zip How do you get the files in this patter so you only get a SINGLE file called "NewFile" and also get the missing ones as integers, in this case (3, 5) Right now I am checking files one by one and if the name only...

How to get the explorer right click menu in Winforms ListView?

I am using a Winforms ListView to show some files, but other than showing the files like explorer does, I want to have the same explorer right click menu when you get when you right click an item inside. Is this possible? How do I enable it for my ListView app? ...

How to eliminate "halo" in images with transparent backgrounds.

I'm using DrawImage() to paint some images on a form with transparent background. Those images which are partly transparent cause a "halo" effect.(Look at the screenshot) What's the best way to prevent that from happening EDIT These same icons look great on my desktop so there should be some better way of painting the icons. ...

What are the original reasons for ToString() in Java and .NET?

I've used ToString() modestly in the past and I've found it very useful in many circumstances. However, my usage of this method would hardly justify to put this method in none other than System.Object. My wild guess is that, at some point during the work carried out and meetings held to come up with the initial design of the .NET framewo...

Generate mp3 from midi

I need to generate MP3 files from MIDI files in batch. Is there a library that can do that? Preferably open source and written in .NET ...

How to get security question answer in .net sql membership provider?

Hi, Is there any way to get form code level security question answer in .net SQL Membership Provider? I'm struggling with allowing user to have change password reset and change features using the same provider. Do anybody knows how to do that? Or if I would like to use question and answer feature it means that I automatically have to us...

How to write Tests for Data Access Layer in .Net?

Is there a framework to write unit test for Data Access layer? There are several issues in this. 1. How to populate your database? 2. How do we make sure that one test is not modifying values in db that can fail another test? Is there a good framework available which can take care of above issues? Update: I came across nDBUnit which ...

Crossfading - Best way of getting audio C# .NET Compact Framework?

I'm using .NET Compact Framework 3.5 and I'm wanting to crossfade two tracks of music. The time at which they would crossfade isn't known, the idea is one would loop and something would trigger a crossfade. I know SoundPlayer can play multiple tracks on top of one another and that (though I've not been able to get it to work), WaveOut ...

What‘s the difference between persistent policies and policies in Object Builder2

the BuilderContext type in OB2 has two properties,PersistentPolicies and Policies,my question is what‘s the difference between PersistentPolicies and Policies? Thanks. ...

Hit Breakpoint When Caused by the Debugger

Is there a way to have breakpoints hit when the action is caused by the Visual Studio debugger? For example, let's say I have the following (I know you shouldn't do this, just using it for argument's sake): public class Test { int _X = -1; public int X { get { return ++_X; } //Breakpoint here set { _X = value; }...

Why is BinaryFormatter trying to serialize an Event on a Serializable class?

I have a simple class that is marked as Serializable, and it happens to have an event. I tried to mark the event member as NonSerialized, however the compiler complains. Yet when I go to serialize the class instance, the BinaryFormatter throws an exception that the event is non serializable. Does that mean you can't serialize classes tha...

How to show only the base url of the web-application on address bar of browser even if we go to any page?

We want to show only the base url (www.myapplication.com) of the web application even if the use browse to any other webpage in the application. Please guide. Thanks in advance. ...

A CASPOL command to completely trust all code

We have a a couple of old framework 1.1 applications at my workplace, and we have run up against security exception problems. At this stage, I don't have the option of upgrading the apps to use ClickOnce security. What I am after is a CASPOL command that will just allow any .NET applications to run on the users machine, regardless of wh...