.net-2.0

XML-Serializing delegates

I have a class that I want to be serializable but contains a public instance of delegate that, apparently can't be serialized: <Serializable()> Class A Public Delegate Function TestEventHandler(ByVal myObj as CutomObject, _ ByVal myObj2 as CustomObject) as Boolean ' does not 'want' to be...

LinkedList<T> can not be serialized using the XMLSerializer

A LinkedList can't be serialized using XmlSerializer. Now, how to however save/retrieve data from a serialized objet LinkedList. Should I implement custom serialization? What I tried to do: using System.Xml.Serialization; [Serializable()] public class TestClass {     private int _Id;     private string _Name; private int _Age; ...

Designer resets property value

I have a problem setting a default value on a property, that is "updated" by Visual Studio Designer every time the form is modified in it. Situation: class MyHour { MyHour() {} MyHour(string h) {} } class MyPanel { _FirstHour = new FirstHour("13:00"); [DefaultValue("13:00")] Hour FirstHour {get { return _Firs...

Is there a recommended ASP.NET 2.0 method to serve HTML snippets via XHR to the client?

Here is my desired flow: A static web page (html) uses XHR calls to an ASP.NET page The .NET page retrieves information from a remote server using web services The .NET page returns an HTML "snippet" that is inserted into the static HTML page I'm getting hung up on how to deal with the HTML snippet generation on the .NET (2.0) page. ...

Comma Seperated string Built In .NET

I used a built in function to create comma separated string using List easily. (It is not split and join but new function) I'm not able to recollect or find it. If some one knows about it and uses it please post a link to that. Framework - .net 2.0 (It is not Join or split - I know about this, .net has new built in function to create CS...

System.Web.Extensions 3.5.0.0 with .NET 3.0

Is it possible to use System.Web.Extensions 3.5 without upgrading to .NET 3.5? We are using .NET 3.0 and have been asked to upgrade from web extensions 1.0 to 3.5. ...

Avoid duplicates

hi all, how can i avoid duplicates from a string (in c#) eg.i have a,a,b,b,c i want to get the answer like a,b,c ...

Migrating .NET 2.0 (VS2005) C# solution to .NET 3.5 (VS2008) - What problems to expect?

My team is looking into upgrading our large-ish C# solution (~30 projects, probably thousands of files) from VS 2005 to VS 2008. From your experience, what problems, if any, are likely to appear? Oh yeah, there are a few isolated components still using VS2003 that should also be upgraded to VS2008. ...

How to Xml serialize a LinkedList?

.NET 2 Actually there are methods to XML serialize a List<T>. What if I have an object that has a public LinkedList<T> member? Without creating a public duplicate as List<T> from LinkedList<T>. Maybe a way to control the Xml serialization like binary (OnSerializing, OnDeserializing). Will be impossible to XML serialize a object with ...

Writing a cross framework class, ConfigurationManager and ConfigurationSettings

I'm trying to write a little web.config reading class, and want it to be available for all .net framework solutions I am writing. Everything is going fine, except for .net 1.1 and below I need to use System.configuration.configurationsettings.appsettings and for after 1.1 am using System.configuration.configurationmanager.appsettings. ...

What changes do I have to make to a .NET 2.0 Application so that it installs and runs fine on Windows Server 2008

I get CLR20r3 error and very non-descriptive messages. I tried making an installer as well as used click once to deploy the app onto the server but failed both the times. Is there a set of steps that we have to go through to target 2008 server deployments? Here is the error message : Description: Stopped working Problem signature: ...

C# Wait until all threads terminated in ThreadPool

I have one main thread, and many other background threads. The main usage of those background threads is to query data (many queries from the web, which is why I create multiple threads: to avoid the lagging the user interface). When it comes to exporting the data in the main thread (the user interface), I need to wait until all the ot...

AesManaged versus RijndaelManaged

Hi all, I'm currently porting a peace of code written in .NET 3.5 to 2.0. At some point in the code (heavy load) the AesManaged class is being used, are there any performance gains from this implementation compared to RijndaelManaged, and should there be any risk when changing from AesManaged to RijndaelManaged concerning heavy load? g...

What's a useful pattern for waiting for all threads to finish?

I have a scenario where I will have to kick off a ton of threads (possibly up to a 100), then wait for them to finish, then perform a task (on yet another thread). What is an accepted pattern for doing this type of work? Is it simply .Join? Or is there a higher level of abstraction nowadays? Using .NET 2.0 with VS2008. ...

C# once the main thread sleep, all thread stopped

I have a class running the Producer-Consumer model like this: public class SyncEvents { public bool waiting; public SyncEvents() { waiting = true; } } public class Producer { private readonly Queue<Delegate> _queue; private SyncEvents _sync; private Ob...

Virtual Database in Memory

Imagine the following: I have a table of 57,000 items that i regularly use in my application to figure out things like targeting groups etc. instead of querying the database 300,000 times a day, for a table that hardly ever changes it's data, is there a way to store its information in my application and poll data in memory directly? Or...

How can one change a Windows 2000 computer name in .NET 2.0?

I'm trying to change a computer's name (host name) on Windows 2000 using .NET 2.0. The computer is not joined to a domain. Windows XP and higher provides the WMI method Win32_ComputerSystem.Rename, but this is not available in Windows 2000 (reference here). I'm not averse to just calling an external program if I need to, but I also ca...

Do .NET 3/4 Permits Events to be Binary De/Serialized?

In .NET (at least <=2) there's a problem serializing objects that raise events when those events are handled by a non-serializable object (like a Windows Form). Because of the way VB.NET implements events, when you serialize an object, its events get serialized too (because events are actually implemented using hidden multicast delegate...

What is the best way to print a report to PDF in ASP.Net?

I have a complicated report that I need to draw with GDI+ (I don't know of a better way) with multiple pages and have it save to PDF so the user can download. What is the best way to do this? ...

Is it possible to use Object Initializers on a bool?

Is it possible to do the following (e.g. initialize bool array and set all elements to true) in one line using object initializers? int weeks = 5; bool[] weekSelected = new bool[weeks]; for (int i = 0; i < weeks; i++) { weekSelected[i] = true; } I can't quite get it to work. Edit: I should have mentioned that I am using VS2008 ...