.net

C# - Delegate with ref parameter

Is there any way to maintain the same functionality in the code below, but without having to create the delegate? I'm interfacing with a 3rd-party API that contains a number of various DeleteSomethingX(ref IntPtr ptr) methods and I'm trying to centralize the code for the IntPtr.Zero check. private void delegate CleanupDelegate(ref IntP...

How to make a WCF client ignore the response?

I have a contract in the same signature as an Action<T> delegate: [ServiceContract()] interface ISomeService { [OperationContract()] void DoSomething(object data); } Will the client wait for the server side method execution to finish? If yes, how to prevent this? Should I use async calls to achieve my goal? ...

how to optimize time in webservice while sending request and receiving response?

I m working with some web services where i m requesting for web service around 4000 times in loop each time i m getting some data from web service, that is working fine...but the problem is that it's taking time...obviously 4000 times cost a time, but is there any way that we can optimize the time with this? thanks. Actually .. i have ...

WinForm control to list files in a directory

I'm new to the WinForms control toolbox, so I'm looking to get suggestions on which control I should use for the following simple situation: I want to have an area on my form that shows a list of the files in a particular directory. My first quick and dirty inclination is to put a textbox on the form and populate it line-by-line usi...

Building a Roguelike in Silverlight (or WPF)

I've been toying with the idea of building a web-based Roguelike game using Silverlight (or maybe just a desktop game using WPF). If you don't know what a Roguelike is, it's a type of graphical RPG where the graphics are rendered using text. Because the graphics engine is relatively simple, you get to spend your time building features i...

Algorithm to swim like a fish in c#

I need to implement a feature in my application where these words are going to "swim" around in the background, basically I need to pick a point in front of the leading letter of the word, and swim to it using a "wavey" style. I also need to avoid the walls, so it turns in time, among other 'fish like' behaviors it needs to implement. ...

How do I get reference to a control on a Datalist's OnItemBound?

Hey everyone, I need to set custom attributes on a control as it is bound to a datalist. I see that the event arguments has a collection of controls but I do not see any reference name associated with them. How can this be done? When I try this: (e.Item.FindControl("autoChartChkBox") as CheckBox).Attributes.Add("CompanyToken", "Compan...

Format double with no decimal point

Hi, I've to convert double to 10 digits + 4 decimal. so let say: I have a double 999,56. I've to get 00000009995600 -> without comma! What I have is: string.format("{0:0000000000.0000}", value) but what I get is: 0000000999,5600 so what I can do now is to search for the comma and delete it, but I would like to know if there is anoth...

How do I escape the # character in a VB.NET string literal?

If I needed to escape a double quote character within a string literal I'd use two consecutive double quotes as follows: Dim name = "Chuck ""Iceman"" Liddell" However, it doesn't seem like consecutive # works the same way. The compiler is expecting a compiler directive to follow the # character, even when its enclosed in double quote...

F# Serialize Discriminated Union why so many bytes?

I'm trying to serialize some data for a UDP packet stream and I'm getting a huge overhead from serialization. If I encode a FileData with a 1k Byte array I get back 2312 bytes. How would I reduce this overhead without encoding and decoding everything myself? [<Serializable>] type Response = | FileSize of String * int64 | FileD...

Checking for presence of .NET remoting server - is my approach correct?

It's not possible to set a connection timeout on a .NET remoting call. Documentation occasionally refers to TcpChannel properties that allegedly do this, but discussions and the most recent docs I've found indicate that this is not possible. One may set a timeout on the remoting call itself, but not on the initial connection attempt. ...

.NET Webservice = The surrogate pair is invalid

Getting the following thrown error when calling a web service. Have googled without any results other then people asking the same question. Server was unable to process request. ---> The surrogate pair (0xD860, 0x27) is invalid. A high surrogate character (0xD800 - 0xDBFF) must always be paired with a low surrogate character (0xDC00 - 0...

Exception on SslStream.AuthenticateAsClient (The message was badly formatted)

I have got wierd problem going on. I am trying to connect to Apple server via TCP/SSL. I am using a Client certificate provided by Apple for push notifications. I installed the certificate on my server (Win2k3) in both Local Trusted Root certificates and Local Personal Certificates folder. Now I have a class library that deals with that...

WYSIWYM editor for desktop (.NET/WinForms)

What can I use as WYSIWYM editor for desktop application (preferably .NET/WinForms)? I need functions as paragraphs, headings 1, 2, 3, (un)ordered lists, strong and no other formating (restrictive). Editor wymeditor.org is bad for me purpose because I can paste anything to it from clipboard. I prefer no webbrowser/javascript editor integ...

DataSet with multiple tables

Hello, I have a little problem. I don't know how to use the DataSet in VB.NET correctly. In Visual Studio 2008 I created a DataSet called Network. For the DataSet I took two tables from my database, tServer and tClient. tClient has a foreign key referencing the ID in tServer. After creating the DataSet I found a new namespace called N...

Return Multiple Columns in Linq to Sql?

Hi How do I return multiple columns with linq to sql in C#? I tried to end my query with select new { A.Product, A.Qty }; but this returns some anonymous type and I am not sure what the heck what to do with this, How to return it and how to extract information out of it. I want to put it in some sort of array. thanks ...

Edit and Continue in Silverlight?

Edit-And-Continue is one of my favorite debugging tools which I have previously used on C# based Winforms and ASP.NET projects. However, I'm running a Silverlight 3.0 application on VS 2008 and whenever I try to make a change (after breaking) it says "Changes are not allowed when debugging Silverlight applications". Also there isn't an "...

Seeing new properties on a custom UserControl in Visual Studio

I have two C# .NET projects in my solution. One project is a DLL that contains a WinForms custom UserControl. The other project is a WinForms EXE that references and uses that UserControl on a Form. I have added a handful of properties to the UserControl so that when I place the control on a form I can easily set these properties in t...

How do I write a Regular Expression to match any non-empty content of an XML element that has no children elements?

I am trying to match elements that have no other children elements, but also have content. No content also includes whitespace and &nbsp; characters. I need to do this in C#. Take this XML for instance: <1> <2><3 /></2> <4> <5>This is match 1</5> </4> <6> </6> <7> &nbsp;&nbsp;&nbsp;&nbsp; ...

.NET winforms to Apple Macintosh

Hi, I have a winforms of .NET running in windows OS, my client wants the same to be run on macintosh OS, how do i start on this? Is there a conversion framework (mono/etc) available to implement this? Please reply. Thanks in advance, Karthick ...