.net

How to get a Stream from in-memory Image?

I have an in-memory Image, I need to get a Stream from it to write into an OpenXML document. Can someone please point me to the correct method. ...

How to Log exceptions caught in WCF service deployed on Azure

Hi All, What is the best way to log the exceptions caught in WCF service hosted on cloud? ...

How to add values to listbox ?

I have Datatable collected with my Column Names.. I want to add them in listbox.. Many column are there.. So need to use For each how can i achieve this ...

When should I go for an Interface and when for an abstract class?

Possible Duplicate: Interface vs Base class I was just thinking about when should some one go for Interface rather than an abstract class. I know interface is useful for multiple inheritance but apart from that what other advantages it provides over abstract class? ...

Fluent nHibernate saving null id - leaves orphans

Hi, I'm witnessing some strange behaviour from Fluent nHibernate. I have two objects involved in this problem: a "Page" object and a "Metadata" object. A Page can have multiple Metadata objects attached, and the mapping is done thus: 'in PageMap HasMany(Function(x) x.MetaData).Cascade.All() 'in MetaDataMap References(Function(x) x.Page...

Reading/writing of reference typed field by multiple threads WITHOUT lock

Context: highly threaded server-side application with many reads, occasional writes. Let us consider the following simple code: [Serializable] public class BusinessObject { // ... lot's of stuff, all READ ONLY!!! } public class BusinessObjectHost { private BusinessObject bo; public BusinessObject BO { get { retu...

How much time takes a form to resize?

In order to compare performance of custom drawing I need to calculate the time a form takes to resize (or maximize - pass from its normal to maximized state). Where should I start / stop the StopWatch? Tried OnResize/OnSizeChanged and also OnResizeBegin/OnResizeEnd but both depends of how quick I drag the mouse... ...

Callbacks in Composite Application Block

Hello, below code says I can not convert from void to bool, thats ok but how can I define a callback for a fired event in CAB ? internal bool IsÖrtlichkeitFocused() { return this.WorkItem.EventTopics[EventTopicNames.IsOertlichkeitFocusChanged].Fire(this, new EventArgs<bool?>(null), this.WorkItem, PublicationScope.WorkItem); ...

What are the various scenarios where one would prefer BizTalk ?

What are the various scenarios where one would prefer BizTalk Server ? Further which version of BizTalk would you recommend 2006 or 2009 ? ...

How to embed .xml file into a .NET assembly?

Hi, I have to parse (for localization purpose) .NET assemblies and create satellite assemblies. Currently, I take all the resources from the base assembly, parse them, and then create the satellite assembly. Most of the parts are solved, but if I parse an assembly containing a .xml public resource, when embedding the translated xml into...

Have any one implemented Vedic-mathematics in software before?

Have any one implemented Vedic-mathematics in software before? Vedic mathematics is incredibly beautiful and uses smart algorithms to do addition, subtraction, multiplication etc. I'm trying to program this algorithms in C#. I hope it will do the required operations in fast time and will solve the overflow problems. I don't want to re...

Access or use bulit-in features of any Microsoft Application in .Net

If I want to use/access the features of Microsoft products(Say Microsoft Word Grammer Check feature) in .Net windows/web application, how can I achieve this? Do I need to access the corresponding DLL(or Namespace) to use the features? If so, please provide me a sample to use the feature of other Microsoft products in .Net application. Pl...

In a STA thread: Form.Hide() = BackgroundWorker event not firing??

Hi, I want to hide the main window while the backgroundworker is working, but When I set the main form as this.Hide() before the backgroundworker.RunWorkerAsync(), Both ProgressChanged and RunWorkerCompleted are not firing. How can I achieve this? thanks. More code: ProgressChanged and RunWorkerCompleted are firing with: private void b...

how to pass a converter (constraints not applicable for generic arguments)

I want to pass a converter to a method, and the constraint must be that the converter always gets a string as argument. I tried the following, but it won't compile: class Test { public void Foo(string val, Converter<Tin,Tout> conv) where Tin:string { myObj = conv(val); } } ...

string s= @"somet"hing" what is wrong about this ?

I expected that there is no something wrong but VS2010 gives error. string s= @"somet"hing"; ...

How can I create a .net remoting IPC channel accessible from all sessions?

If I have a Windows Service running in its own session (Session 0 isolation Vista/7), my GUI application in the users session cannot connect via .NET remoting using a IPC channel(named pipe). I do not want to use the TCP channel. Can I specify the channel as global? ...

COM class Returning byte[] in .NET - Whether to release memory or not

I have a COM component having a MyDataObject class. There is a method with the following signature: HRESULT MyDataObject::GetData(long Format, VARIANT* retval) This COM object is used in a .NET application and the method returns either a string or byte array depending on Format value. The returned value is converted to a byte[] in .NE...

A simple question about LINQ to XML

<root xmlns:h="http://www.w3.org/TR/html4/" xmlns:f="http://www.w3schools.com/furniture"&gt; <h:table> <h:tr> <h:td>Apples</h:td> <h:td>Bananas</h:td> </h:tr> </h:table> <f:table> <f:name>African Coffee Table</f:name> <f:width>80</f:width> <f:length>120</f:length> </f:table> </root> I am trying to practice Li...

skype - intercepting in coming audio - callback manipulation failed - skypefx

Hi, In order to intercept external audio that comes in I tried InPort ="3756" call.set_OutputDevice(TCallIoDeviceType.callIoDeviceTypePort, InPort.ToString()); // initialized inServer inServer = new TcpServer(InPort); inServer.DataReceived += inServer_DataReceived; // In dataReceived event I tried playing a wav file args.Buffer = ...

How can I programmatically check (parse) the validity of a TSQL statement?

I'm trying to make my integration tests more idempotent. One idea was to execute rollback after every test, the other idea was to some how programatically parse the text, similar to the green check box in Query Analyzer or SSMS. How do I get SQL Server to parse my command without running it using ADO.NET? UPDATE: This is what finally...