.net

Exception Type thown on dupicate collection item adding

Following code should throw exception to prevent adding duplicate collection item. ICollection<T> collection = new List<T>(); public void Add(T item) { if (collection.Contain(item)) { throw new SomeExceptoinType() } collection.Add(item); } What standard exception type is the most apropriate? ...

Caching for .NET (not in websites)

I need a cache that responds to memory pressure like the one build-into ASP.NET. I'm not using a web site, however, I'm building a Windows Service. Any suggestions? (code, techniques, products, I don't care as long as it's in-memory) ...

I'm a .NET/WCF/Visual Studio programmer. What's a good way to learn Silverlight3 and Blend?

I am familiar with XAML, but I'm no expert. I'm not a designer. In the past I learned much by examining other people's code, good and bad. Is this a reasonable approach with Silverlight? and if so, where can I look at open-source SL projects or examples? If this is not a good approach, what do you recommend? Or should I just punt ...

.NET Assembly Diff / Compare Tool - What's available?

I'd like to be able to do a code-level diff between two assemblies; the Diff plug-in for Reflector is the closest thing I've found so far, but to compare the entire assembly is a manual process requiring me to drill-down into every namespace/class/method. The other tools I've found so far appear to be limited to API-level (namespaces, c...

Inserting Integer Value in TextBox

I need to show an integer value in a TextBox in my C# windows forms application (GUI). I have an int32 value available. I could not find a container like a TextBox that takes int values. The TextBox only accepts Strings. How do I type cast? Any help is much appreciated. Thanks, Viren ...

Some issues with sending List<T> as IEnumerable<T> to a method.

Possible Duplicate: Upcasting and generic lists Ok, I want to send a List<CardHolder> as an IEnumerable<ICardHolder> where CardHolder : ICardHolder. However, the compiler errors: Error 4 Argument '1': cannot convert from 'System.Collections.Generic.List' to 'System.Collections.Generic.IEnumerable' This seems strange to me...

reflection dll comments

Hi, Is it possible to read the comments on the dll. Comments are listed under Version when one looks at the property of the dll. I know that i can get the version number but would rather get the comments as it is user friendly. Assembly.GetName.Version.ToString --will give version number thanks ...

What MVVM framework are you using?

I am looking to write a WPF app and am trying to pick a MVVM framework to handle some of the complexity. What would you recommend and where can I find a good tutorial/getting started guide for said framework? ...

RegEx matching 4 floats

I can't for the life of me understand why the following regex can't match 4 floats. there is a couple of rules for the way theese floats can be written. the float ranges from 0 to 1 you can skip the first digit if its 0 there is an unlimited number of digits after the period. Theese are valid floats 1 1.0 0.0 .0 0.123 .123 Now fo...

Which C#/.NET Twitter API do you recomend?

I wondering if I'm going to make a twitter app, but not sure which one of these libraries I should use. Any suggestions? C#/.NET Libs The app should be able to post new tweets, read tweets(from "All Friends"), read "Mentions" and Direct Messages. Possibly also a search function... ...

C# passing ref type parameter issue

Hello everyone, Suppose I have the following code snippets, i.e. goo call foo, DataTable created by goo and foo will only call Rows.Add. Then goo will use the updated data of the DataTable instance from foo. My question is, in my scenario, any differences or benefits compared of using with and using without ref parameter? I am using C...

Options to display 20 - 200 items for user selection in a winform app?

I have need of a checked combobox control like this one --> DevExpress (I am using this now and would like to move away from DevExpress for many many reasons) I am willing to attempt my own control though I would like*(read need)* some direction. I am willing to use Krypton's Free Tools and extend them (if possible) though; I cannot, a...

How do I draw an Image with a programmatically set alpha channel in .NET?

This is a .NET application on Windows forms using C++/CLI. I have a JPEG that I want to paint in my client area to represent an object. On some occasions -- like when the user is dragging objects around -- I'd like to draw the object with some transparency. What are the various available ways to do this? ...

response size limitaiton of a WCF web serivces

I am hosting a WCF service in IIS using basicHttpBinding. The WCF web services queries back end SQL Server 2008 by using ADO.Net and return a DataTable to client side of WCF service. I find when the returned DataTable is big, there will be exception said http connection is closed by IIS. Any ideas what is wrong and how to set bigger res...

Techniques to create PDF report from templates using iTextSharp

Hi, I've got a project where I need to generate PDF reports from a template. The report will have a header, details and a footer, and can potentially run on multiple pages. I was going to use iTextSharp for that. For the templates i was thinking of two options: PDF Form template HTML template Can you comment on the pros and cons of...

Google Wave for .Net

Just got my wave sandbox invite today. Does anyone know of a .NET library for google wave? (client and server) I'm a c# programmer, not very familiar with the language that the Google samples are written in. It's very existing can't wait to write something for it. ...

7z and file flush. Its not compressing my file.

In encryptFile file if i change the if statement to true the code will work as expected. However i get console windows on screen which is ugly. When i make it false FileListName compress as empty archive. Why? using (TextWriter tw = (TextWriter)new StreamWriter( FileListName)) { writeFilename(tw, t, "."); ...

Checking for directory and file write permissions in .NET

In my .NET 2.0 application, I need to check if sufficient permissions exist to create and write to files to a directory. To this end I have the following function that attempts to create a file and write a single byte to it, deleting itself afterwards to test that permissions do exist. I figured the best way to check was to actually try...

Estimation of the percentage of windows OS users using .net 3.0?

Hello all, I am building a web application that has very high requirement. I wanted to build it first in silverlight and activex, with javascript breaching between them. Later I started considering using xbap. The problem is that xbap demands .net 3.0, and before starting to write an application with such demands I wanted to have a gene...

How to Add a ClickOnce program to the Vista TaskScheduler?

This should be a duplicate question, but I haven't be able to dig up the answer. I want to add a task to the Vista Task Scheduler that launches my ClickOnce installed program. As I understand the .exe of the application is hidden? So I tried to enter the desktop shortcut as the item to start in the Action tab. But this does not work. I g...