.net

Why a BinaryWriter closes the outer Stream on disposal, and how to prevent that? (.NET C#)

I have one method that receives a Stream to write on it using a BinaryWriter. But when I dispose this BinaryWriter it also closes the stream. Can I leave it undisposed so I can leave my stream open? ...

Tcpip listener sockets SSL streams so much confusion

I am trying to code up a tcpip server using .NET. Looking at the threads on this site the general consensus seems to be use some variation of the .NET 3.5 SocketArgs classes to be maximally scalable BUT I have to use SSL as well, and the only way to do that seems to be to use a tcplistener and then grab a tcpclient from the Begin\End Acc...

Mono and window.external

This will be a Windows Forms application deployed through ClickOnce. The plan is to use the WebBrowser control to expose a web application that makes use of Active-X controls. Using window.external and InvokeScript, the objects will be replaced with references to Reg-Free COM objects (SXS). I know this sounds like a mess, but it's a les...

What's the fastest way to read/write to disk in .NET?

I've got a little program that reads and writes files on disk. Breaking it down to the most simple level, it reads bytes from one file stream and writes them to another. It performs its duties fine, but it isn't the fastest thing. I've seen other applications that can tear through a gigabyte or more of reads/writes in amazing speeds. ...

WCF Peer to Peer, Are There Nodes Out There?

I am using WCF in .NET 3.5 to implement a peer to peer networking application. To resolve peer nodes I am using PNRP. IGlobalStoreServiceContract is my contract as shown below, [ServiceContract(Namespace = "http://GlobalStoreEventDriven.API", CallbackContract = typeof(IGlobalStoreServiceContract))] internal interface IGlobalStoreServic...

What is the difference between boxing/unboxing and type casting?

What is the difference between boxing/unboxing and type casting? Often, the terms seem to be used interchangeably. ...

AWGN generator for .NET

I'm looking for an Additive White Gaussian Noise generator for .NET. I know that somewhere there is some degree of interoperability between .NET and MATLAB, which has a AWGN generator, but I don't know if its free EDIT and I just found it. Probably other applications as GNU Octave, which have similar functionalities to MATLAB, have .NE...

Is there an Attribute I can use on a property to tell DataGridView how to format the column?

Following on a bit from this question, if I have this class: private class MyClass { [DisplayName("Foo/Bar")] public string FooBar { get; private set; } public decimal Baz { get; private set; } } And I want to display a List<MyClass> in a DataGridView (with autogenerated columns), what's the easiest way to make the Baz column di...

c# new() keyword

What does the new() do in the code below? public class A<T> where T : B, new() ...

Import Address Book from Gmail/Hotmail/Yahoo using C# and ASP.NET

Hi can somebody tell me how to import all of my contacts from gmail, yahoo, hotmail and so on.. and i want to send an invitation for all my contacts? How can i achieve this? Thank you, Nagu ...

How do I programatically retrieve the actual path to "Program Files" folder?

I realize the odds of a user changing the Windows default of C:\Program Files is fairly slim, but stranger things have happened! How can I get the correct path to Program Files from the system? ...

Binding IList type with DataGridView DataSource

Hi, I have an XML as mentioned below: <Root> <Order ID = "order1"> </Order> <Order ID = "order2"> </Order> <Order ID = "order3"> </Order> </Root> I am using XML Serialization to reading and w...

Regarding Tabcontrol and forms

Hi, I have developed an application in windows forms.but now i was told to put the same in a tabbedpage.the problem I'm facing is how can i insert forms in a tabbed control .and if this is not possible,then what can i do .i need to navigate between the pages(or forms)and data shud be persistent while navigation. is there any way to inse...

LiquidMachine Exception

I am using LiquidMachine API for encryption of document. I have a ref in my project for CSharpCPAPI.dll v1.0.3182.27556. It was working fine untill i copies the solution on another machine.On the new machine, this code is throwing an exception when Iniitializing the ContentProtectionLib i .e ContentProtectionLibrary.initialize(new Cont...

Watch an object graph for changes

Is there a way to watch an object graph for changes on any object, and do something based on that change? Lets say I have the following: public class Main:INotifyPropertyChanged { public ObservableCollection<Foo> FooItems { get; } public ObservableCollection<Bar> BarItems { get; } } public class Foo:INotifyPropertyChanged pub...

Tool to determine an assembly's trust level in .NET?

Is there a tool to indicate what kind of trust level it has? ...

Uses of delegates in C# (or other languages)

I have always wondered how delegates can be useful and why shall we use them? Other then being type safe and all those advantages in Visual Studio Documentation, what are real world uses of delegates. I already found one and it's very targeted. using System; namespace HelloNamespace { class Greetings{ public static void Displ...

.NET (C#) winforms "tweet" UI control question

I'm a real dummy at UI building, so I'm wondering - what .NET winforms control would be best to use if aiming to display tweets in a list fashion that updates with like boxes which contain the text of the tweet and its metadata below it. Is there a specific winforms list function for this type of thing? Or do you recommend I look for/use...

How to create Event Handler for my Class

I have following class public class ButtonChange { private int _buttonState; public void SetButtonState(int state) { _buttonState = state; } } I want to fire an event whenever _buttonState value changes, finaly I want to define an event handler in ButtonChange Will you guys help me please?? P.S : I dont wan...

Trace listener - creating memory overflow

I am using tracelistener in a multithreaded application to log message remotely, but the appllication creates memory overflow. For testing I created 10,000 threads, and tried to log messages using TraceData function. Does .Net framework create an object for every call to TraceData, which result in memory overflow? ...