.net

ASP.NET - best queue system for a new application

My organization is getting ready to implement a new system, which is a asp.net application. The application will have a large queue of offline work that is initiated by the website. This queue will hold different types of activity, ideally in XML messages. Think of things like email notifications, scheduled tasks, etc. In the past, t...

Source Control Layout

I develop a variety of applications and have 3-4 miscellaneous libraries that I reuse across these apps (one for math, one for database functions etc.). Currently I have one master source directory with each project as a top level directory (including my helper projects). And each project that needs a helper adds the entire project as a...

Truncate Decimal number not Round Off

I want to truncate the decimals like below i.e. 2.22939393 -> 2.229 2.22977777 -> 2.229 ...

Checking if a file is a .NET assembly

I've seen some methods of checking if a PEFile is a .NET assembly by examining the binary structure. Is that the fastest method to test multiple files? I assume that trying to load each file (e.g. via Assembly.ReflectionOnlyLoad) file might be pretty slow since it'll be loading file type information. Note: I'm looking for a way to chec...

Silverlight & WCF: Max message size

Hi there, When I pass a list of objects out of my silverlight app using WCF everything works fine until the List grows too big. It seems that when I exceed 80 items I get the error: The remote server returned an unexpected response: (404) Not Found I'm presuming that it's because the List has grown too big as when the List had 70 items...

Retrieving product information from an unmanaged executing application in C#/.NET

In C#, it is possible to retrieve assembly related information like product name, version etc using reflection: string productName = Assembly.GetCallingAssembly().GetName().Name; string versionString = Assembly.GetCallingAssembly().GetName().Version.ToString(); How do I do the equivalent if the executing assembly is written in unmanag...

Are there any web-based, standalone (no-install), or no-admin installer compilers for C#

Hi All, I'm looking to spend a bit of my lunch break each day teaching myself some C#. I have access to some books on the subject via my employer-paid Books24x7 subscription, but I have no way of running code while I'm at work. My work PC is rather locked down (no admin privileges, read-only "Program Files" - though install to a deskto...

How do you change directories using FtpWebRequest (.NET)?

Can someone tell me how to change directories using FtpWebRequest? This seems like it should be an easy thing to do, but I'm not seeing it. EDIT I just want to add...I don't have my heart set on FtpWebRequest. If there's a better (easier) way to do FTP in .NET please let me know. Apparently there's no way to do it using a live con...

Setting LinqDataSource bound DropDownList using URL querystring

Hi folks, This is a puzzle for me, I am able to get three DropDownLists to behave like a cascade (it fetches the correct data) but where I run into problem is where I try to set the value for the dropdownlist based on the value of the querystring. Only the first dropdownlist seems to take it's value from the querystring. The other t...

Creating a Windows service with user notification in C#?

I want to create Windows service in such a way : -> It takes input database information ... -> at completion of service it notifies user for completion of process. How can I do this with Windows service in C#.Net? Thanks ...

Why we can not have Shared(static) function/methods in an interface/abstract class ?

In .net we are not allowed to have shared function/methods in abstract classes and interfaces. Why they are not allowed ? Is this same in other languages. like Java ? What can be the potential problem if the Shared methods are allowed ? ...

Uses of KeyedByTypeCollection in .Net ?

While checking out the generic collection in .net i found about KeyedByTypeCollection. Although I worked with it and got to know how to use it, I did not get in which scenario it will be useful. I read through ServiceProvider, cache etc. done with generics without cast, but could not get much. I think, there must have a reason as to wh...

Join collection of objects into comma-separated string

In many places in our code we have collections of objects, from which we need to create a comma-separated list. The type of collection varies: it may be a DataTable from which we need a certain column, or a List<Customer>, etc. Now we loop through the collection and use string concatenation, for example: string text = ""; string separa...

Blocking version of System.IO.Stream.Read(byte[], int, int)

Hello, I'm using System.IO.Stream.Read(byte[] buffer, int offset, int count). Is there an alternative to that method (or a property to set) so that the method won't return until all count is read (or end of stream is reached)? Or should I do something of like this: int n = 0, readCount = 0; while ((n = myStream.Read(buffer, readCount, ...

PowerShell based database synchronisation using a binary file

I have written a database application using a binary file as storage. it is accessed via powershell cmdlets. You can put information into the database using the put- and you can read information using get-. The problem is synchronisation. What is the best way to ensure that the cmdlets don't access the file at the same time? The put- ...

Using Ninject in a plugin like architecture

I'm learning DI, and made my first project recently. In this project I've implement the repository pattern. I have the interfaces and the concrete implementations. I wonder if is possible to build the implementation of my interfaces as "plugins", dlls that my program will load dynamically. So the program could be improved over time wit...

'Proper' collection to use to obtain items in O(1) time in C# .NET?

Something I do often if I'm storing a bunch of string values and I want to be able to find them in O(1) time later is: foreach (String value in someStringCollection) { someDictionary.Add(value, String.Empty); } This way, I can comfortably perform constant-time lookups on these string values later on, such as: if (someDictionary.c...

WinForms: Textbox Leave event doesn't get fired after going to main menu

Hi, I have a TextBox control on my Form. I use the Leave event on the control to process user input. It works fine if the user clicks on some other control on the form, but the even doesn't get fired when the user goes straight to the main menu. Any ideas which event should I use to get it fired everytime? ...

Report Viewer (SSRS 2005) Not rendering correctly with update to .Net 3.5

I'm having an issue with the SSRS 2005 report viewer no longer rendering correctly in the browser. We updated the application that calls the report to use the .Net 3.5 framework and are calling the report from the app via a URL to the report server. The report generates correctly and the layout is fine, the only issue is the report view...

Is there a better way of customizing SOAP headers in C#

In the past I have needed to create custom SOAP headers in a C# project that was using an imported WSDL web reference. I found a way to do it but I was never happy with it and I have sense wondered if there was a better way. What I did was create a header that derives from SoapHeader: [System.Xml.Serialization.XmlTypeAttribute(Namespace...