.net-2.0

What's the maximum amount of RAM I can use in a Windows box?

Obviously, that's 64-bit windows. Also, what's the maximum amount of memory a single 64-bit process can use? I was kind of counting on using it all... (Yes, I know what I'm doing, please don't tell me that if I need that much RAM i must be doing something wrong) Also, is this the same for a .Net 2.0 process? Or is there a lower limit ...

CLR Profiler - Attaching to existing process

I would like to use something like CLR Profiles on .Net 2.0 to see what objects are taking more space in the heap at any given time (of an ASP.Net worker process). However, the CLR Profiler only lets me START an app, not attach to an existing one. I assume this is because it tracks allocations and GC too, but i'm not very interested in ...

COMException "Library not registered." while using System.DirectoryServices

I have only just started received the following error in my windows forms application under dot net 2 framework on windows 2000 when using System.DirectoryServices. {System.Runtime.InteropServices.COMException} System.Runtime.InteropServices.COMException: {"Library not registered."} _className: Nothing _COMPlusExceptionCode: -532459...

Is there a built in way in .Net AJAX to manually serialize an object to a JSON string?

I've found ScriptingJsonSerializationSection but I'm not sure how to use it. I could write a function to convert the object to a JSON string manually, but since .Net can do it on the fly with the <System.Web.Services.WebMethod()> and <System.Web.Script.Services.ScriptMethod()> attributes so there must be a built-in way that I'm missing. ...

How to Catch an exception in a using block with .NET 2.0?

I'm trying to leverage the using block more and more these days when I have an object that implements IDisposable but one thing I have not figured out is how to catch an exception as I would in a normal try/catch/finally ... any code samples to point me in the right direction? Edit: The question was modified after reading through the re...

How can I expose only a fragment of IList<>?

I have a class property exposing an internal IList<> through System.Collections.ObjectModel.ReadOnlyCollection<> How can I pass a part of this ReadOnlyCollection<> without copying elements into a new array (I need a live view, and the target device is short on memory)? I'm targetting Compact Framework 2.0. ...

New Added Types in .NET Framework 2.0 Service Pack 1

I assumed there were only bug fixes/(no new types) in .NET 2.0 SP1 until I came across few posts which were mentioning DateTimeOffset structure, that was added in .NET 2.0 SP1. I there a full listing of the newly added types in .NET 2.0 SP1? ...

ASP.Net: why is my button's click/command events not binding/firing in a repeater?

Here's the code from the ascx that has the repeater: <asp:Repeater ID="ListOfEmails" runat="server" > <HeaderTemplate><h3>A sub-header:</h3></HeaderTemplate> <ItemTemplate> [Some other stuff is here] <asp:Button ID="removeEmail" runat="server" Text="X" ToolTip="remove" /> </ItemTemplate> </asp:Repeater> And in th...

How can I determine whether a given date is in Daylight Saving Time for a given timezone in .NET 2.0?

I'm on .NET 2.0, running under Medium Trust (so TimeZoneInfo and the Registry are not allowed options). I'm asking the user for two dates and a time zone, and would really love to be able to automatically determine whether I need to adjust the time zone for DST. This probably isn't even a valid scenario unless I have some very robust...

"Cannot change DataType of a column once it has data" error in Visual Studio 2005 DataSet Designer

I've got a DataSet in VisualStudio 2005. I need to change the datatype of a column in one of the datatables from System.Int32 to System.Decimal. When I try to change the datatype in the DataSet Designer I receive the following error: "Property value is not valid. Cannot change DataType of a column once it has data." From my understa...

Using yield to iterate over a datareader might not close the connection?

Here is a sample code to retrieve data from a database using the yield keyword that I found in a few place while googling around : public IEnumerable<object> ExecuteSelect(string commandText) { using (IDbConnection connection = CreateConnection()) { using (IDbCommand cmd = CreateCommand(commandText, connection)) ...

How to discover USB storage devices and writable CD/DVD drives (C#)

How can I discover any USB storage devices and/or CD/DVD writers available at a given time (using C# .Net2.0). I would like to present users with a choice of devices onto which a file can be stored for physically removal - i.e. not the hard drive. ...

Issue reading Xml file into C# DataSet

I was given an .xml file that I needed to read into my code as a DataSet (as background, the file was created by creating a DataSet in C# and calling dataSet.WriteXml(file, XmlWriteMode.IgnoreSchema), but this was done by someone else). The .xml file was shaped like this: <?xml version="1.0" standalone="yes"?> <NewDataSet> <Foo> ...

How to force my ASP.net 2.0 app to recompile

I have a ASP.net 2.0 app and I have made some changes the the source file ( cs files ). I uploaded the changes with the belief that it would auto-recompile. I also have the compiled dll in MY_APP/bin. I checked it and noticed that it did not recompile. Please understand I am new to this. ...

Updating Legacy Code from System.Web.Mail to System.Net.Mail in Visual Studio 2005: Problems sending E-Mail

Using the obsolete System.Web.Mail sending email works fine, here's the code snippet: Public Shared Sub send(ByVal recipent As String, ByVal from As String, ByVal subject As String, ByVal body As String) Try Dim Message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage Message.To = recipen...

ASP.Net word count with a custom validator

A requirement for an ASP.Net 2.0 project I'm working on limits a certain field to a max of 10 words (not characters). I'm currently using a CustomValidator control with the following ServerValidate method: Protected Sub TenWordsTextBoxValidator_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidate...

Sorting Directory.GetFiles()

System.IO.Directory.GetFiles() returns a string[]. What is the default sort order for the returned values? I'm assuming by name, but if so how much does the current culture effect it? Can you change it to something like creation date? Update: MSDN points out that the sort order is not guaranteed for .Net 3.5, but the 2.0 version of ...

Create drop down list options from enum in a DataGridView

I currently have a class and I'm trying to create an easy GUI to create a collection of this class. Most of the attributes of this class are strings. However, one of the attributes I want the user to be able to set is an Enum. Therefore, I would like the user interface, to have a dropdownlist for this enum, to restrict the user from ent...

ASP.Net RSS feed

How do I create an rss feed in ASP.Net? Is there anything built in to support it? If not, what third-party tools are available? I'm thinking webforms, not MVC, though I suppose since this isn't a traditional page the difference may be minimal. ...

Merging two arrays in .Net

Is there a built in function in .Net 2.0 that will take two arrays and merge them into one array? The arrays are both of the same type. I'm getting these arrays from a widely used function within my code base and can't modify the function to return the data in a different format. I'm looking to avoid writing my own function to accomplis...