.net

Advantage of using Thread.Start vs QueueUserWorkItem

In multithreaded .NET programming, what are the decision criteria for using ThreadPool.QueueUserWorkItem versus starting my own thread via new Thread() and Thread.Start()? In a server app (let's say, an ASP.NET app or a WCF service) I think the ThreadPool is always there and available. What about in a client app, like a WinForms or...

how to change the type of the parameter in an Expression?

since i am using POCOS in my domain, i want my repository to be able to received Expression filters of the type of my POCOS and change the parameter in the expression to be the of type of my LINQ tables, my fields have the same name as my members so i was able to accomplish this for 1 and 2 lambda conditions by breaking into members and ...

c# set paper size

Please help me how to set paper size in c# code . i am using api printDocument .. my code is ppvw = new PrintPreviewDialog(); ppvw.Document = printDoc; ppvw.PrintPreviewControl.StartPage = 0; ppvw.PrintPreviewControl.Zoom = 1.0; ppvw.PrintPreviewControl.Columns = 10; // Showing the Print Preview Page printDoc.BeginPrint += new...

Lost in .Net SDK with C# due finding the documentation

Hi! Is there anything smart and helpful, that makes you able to search through the Microsoft .Net documentations (in Visual Studio 2008))? Before you mention Google: before you can search through that stuff with Google you have to know what you're searching for. Let's say you don't know exactly what to look for and you insert ".Net C# ...

Retrieving Device Context from .NET print API

I am working on a .NET application to control DataCard Desktop Card printers, and I have stumbled upon a problem. In order to execute Magnetic Stripe and Chip encoding, I have to call a function in a native printer API dll to enable the printers Interactive mode. I have managed to create the P/Invoke code to call this native function. B...

What is the best way to convert a hexidecimal string to a byte array (.NET)?

I have a hexidecimal string that I need to convert to a byte array. The best way (ie efficient and least code) is: string hexstr = "683A2134"; byte[] bytes = new byte[hexstr.Length/2]; for(int x = 0; x < bytes.Length; x++) { bytes[x] = Convert.ToByte(hexstr.Substring(x * 2, 2), 16); } In the case where I have a 32bit value I can d...

Embedding .NET usercontrol in IE8

Hi, I have a simple webpage containing a .NET usercontrol embedded using the OBJECT tag. In IE7, the page displays and I can use the usercontrol. However, in IE8, the usercontrol does not even load. Any thoughts / ideas? ...

What is the best Twitter API wrapper/library for .NET?

I'm looking for a way to programatically generate a twitter feed for a .NET application. Any recommendations as to a good wrapper for the twitter api to ease the work? Boaz ...

Dynamic "WHERE" like queries on memory objects

What would be the best approach to allow users to define a WHERE-like constraints on objects which are defined like this: Collection<object[]> data Collection<string> columnNames where object[] is a single row. I was thinking about dynamically creating a strong-typed wrapper and just using Dynamic LINQ but maybe there is a simpler so...

Change Location Folder?

I have just few days to show a demo about a Music Player in WPF and i have a trouble that i can not work out right now . I need know how change a location folder meantime the Music Player is running ,i have 3 location folder: D/: Morning; D/: Afternoon; D/: Night; in each folder there are songs of different genre. This music player...

How do I find out what originally caused an exception, if it gets thrown from Microsoft's code?

I have two controls containing DataGridViews on different panes in a DockPanel. If one is in edit mode and I switch pane, I get a NullReferenceException thrown from within the DataGridView's EndEdit() method. The stack trace doesn't go any deeper than that and the exception doesn't contain any more information. I've looked at that met...

Encrypted data size using RSA encryption (RSACryptoServiceProvider)

I need to use some encryption mechanism in one of the project I am working on. I was exploring RSA encryption and wrote some sample programs to learn. I understand that block size of RSA encryption is 16 bytes. So I gave the string "12345678" as input to below function: public static string Encrypt (string input) { var byteConvert...

is dataset.readxml(string) synchronous?

I'm asking that because I created a windows service and it seem that under heavy load(which in my case when windows is booting up) the data inside the xml doesn't get loaded before I manually do stuff with it in my case is checking how many row are in a specific datatable inside that dataset. dataset got a schema. speudo code would be:...

How to connect .Net app to JMX agent?

I need to connect my .Net application to somebody else's JMX agent. I've read that this is simply not the done thing and I should use soap or practically anything else. As this is just not going to happen, are there any libraries or interop techniques out there that can help me? I'm only interested in the simple things like invoking a re...

Is ODP.NET redistributable?

Are the Oracle ODP.NET libraries redistributable? As in, can I simply include the Oracle.DataAccess.dll with my application & reference it without getting into any legal hot water? The download license for the ODAC on OTN is fairly incomprehesible legalese that doesn't make it clear whether I can or can't include the dll directly. ...

ADO.NET Entity Framework - LINQ to multiple dbms

Is it possible to create an 'Entity' that will be an abstraction of a relationship between tables that live in two different tables, in two different databases, on two different machines, and even possibly using two different dbms? For example, if I have a SQL Server db on one machine that stores all my customers, and I have an Oracle d...

Web Service returning object with null fields

Never seen this one before. WebService.Implementation imp = new WebService.Implementation(); WebService.ImplementationRequest req = new WebService.ImplementationRequest(); return imp.GetValue(req); The object that imp returns is not null. It's returning an ImplementationResponse, as expected. But all of the fields in that object are...

.NET ComboBox Autocomplete failing on slashes

The .NET ComboBox autocomplete will not fully autocomplete with the display text contains a slash. It completes only up to the slash, leaving SelectedIndex == -1 and SelectedValue == null. This behavior stupidly persists no matter whether your autocompletesource is set to ListItems rather than FileSystem or URL. Is there any workaro...

What kind of polling server pattern exists for Windows developers?

Polling servers seems to be a theme that comes up for certain types of enterprise applications, particularly social networking web applications. From what I have read, people on the Unix side use memcache that can give you a few thousand requests per second. What options do Windows developers have since we don't have a memcache alterna...

List of .Net Numeric Type Initialization Identifiers

I'm looking for a list numeric type initalization identifiers for both C# and VB.Net. for example: Dim x = 1D 'Decimal' Dim y = 1.0 'initializes to float' Here's the list: The identifiers are case-insensitive VB.Net Int32 = 1, I Double = 1.0, R, 1.0e5 Decimal = D Single = F, ! Int16 = S UInt64 = L, UL C# ...