.net-2.0

2-Column DataTable to List<int> .NET 2.0

馋奶兔 提交于 2019-12-11 22:36:41
问题 I have populated a DataTable from a stored procedure in an older web application written in C# under .NET 2.0 / Visual Studio 2005. I'm trying to populate a List with the values in the DataTable, but I keep running up against a couple issues. My conversion process looks like this: List<int> SpecialVendorList = new List<int>(); foreach (DataRow datarow in GetAllSpecialVendors().Rows) { //Loop through each row foreach (DataColumn column in GetAllSpecialVendors().Columns) { SpecialVendorList.Add

Sending 2 parameters back to Main function

痴心易碎 提交于 2019-12-11 18:43:49
问题 I got a function which wants to send 2 INT parameters back to where it has been called, but not sure what would be the best option, a Dictionary ? or a List or an Array EDITED I am using .Net framework 2 回答1: I assume you mean return 2 values to the caller. If so: return a Tuple<T1, T2> return your own custom type which stores the desired values, like MyOperationResult use out parameters: http://msdn.microsoft.com/en-us/library/t3c3bfhx(v=vs.80).aspx return a collection It depends on what is

IIS 6/.Net 2:How can user A get the user cookie for unrelated user B who is in a different session and on another box?

烂漫一生 提交于 2019-12-11 18:26:05
问题 1) user A goes to the site, creates an account, and logs in 2) user b goes to the site. Rather than having to log in, user b enters as though user b is user a. User b gets access to all of user a's data and can brows the site as user a. Note: user b does not log in. User b just hits the site, and the site returns as if user b is already logged in as user a. Note 2: user a and user b are on distinct computers. Also, static variables are not involved in the code. Setup: IIS 6 .Net 2.0

C# GDI+ curve drawing issue

别等时光非礼了梦想. 提交于 2019-12-11 18:23:04
问题 I'm trying to draw a series of connected segments, but the curved segments seem to produce an artifact, whereby the outer side of the curve is not smooth at all, but very jagged. This is part of a GIS program I am making. For these lines, the line itself needs to be quite wide, as this represents the range of data that can be collected on this line for the GIS data. There also has to be an area directly under the line where no data is collected. This also can be wide, but not as wide as the

What is the latest version of structuremap that supports .NET 2.0

泄露秘密 提交于 2019-12-11 16:59:56
问题 I'm working on a project that is stuck on .NET 2.0 (though we can use C# 3.0), and I'd like to use the facilities of a nice container (e.g. StructureMap). Does anyone know what the latest version of StructureMap that supports .NET 2.0 is? Or if there is any other container (preferably not Unity, but I could be convinced) that supports .NET 2.0? Thanks in advance. 回答1: That would be StructureMap-2.0. The next release which is StructureMap.2.4.9 already depends on the System.Core assembly which

How to Xml serialize a LinkedList?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 15:45:36
问题 .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 a public LinkedList<T> member? EDIT: An test example to fix with IXmlSerializable using System.Xml.Serialization; public class Foo : IXmlSerializable { private

Developing for Windows Server 2003 64 bit on Windows XP 32 bit

霸气de小男生 提交于 2019-12-11 15:18:46
问题 I have been developing an ASP.NET application on Windows XP Professional. While promoting to production I have only now found out that the server is 64 bit. I installed Oracle Client 32 bit on the server and cannot connect to Oracle. I am using the Microsoft Provider for Oracle, and my question is, how do I get an ASP.NET application compiled on a 32 bit machine to connect to Oracle on a Windows Server 2003 64 bit machine? EDIT: In response to a comment on my original question, the error I am

how to pass objects (byte array) in query if query is not parameterized?

不打扰是莪最后的温柔 提交于 2019-12-11 15:09:59
问题 I have this query to be run: string query = @"SELECT * FROM hint WHERE addedSessionId IN (x, y, z, ............)"; if (_connSource.State != ConnectionState.Open) _connSource.Open(); MySqlCommand cmd = new MySqlCommand(query, _connSource); MySqlDataReader r = cmd.ExecuteReader(); List<Hint> lstHint = new List<Hint>(); while (r.Read()) { Hint h = new Hint(Convert.ToInt32(r[0]), Convert.ToInt32(r[1]), Convert.ToString(r[2]), Convert.ToInt32(r[3]), Convert.ToInt32(r[4])); h.addedSessionId = (Guid

Processing a very large list in batches using System.Threading.Semaphore

霸气de小男生 提交于 2019-12-11 15:07:11
问题 I have written the following code in .NET 2.0 foreach(Item i in millonItemsIterator) { ItemThreadManager m = new ItemThreadManager(i); System.Threading.Thread t = new System.Threading.Thread(m.Process); t.Start() } SendCompletionEmail(); public class ItemThreadManager { private static Semaphore s = new Semaphore(20, 20); private Item item = null; public ItemThreadManager(Item i) { item = i; } public void Process() { s.WaitOne(); // do something with item. s.Release(); } } My intention behind

LinkedList<T> can not be serialized using the XMLSerializer

感情迁移 提交于 2019-12-11 14:28:27
问题 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; private LinkedList<int> _linkedList = new LinkedList<int>(); public string Name { get { return _Name; } set { _Name = value; } } public string Age { get { return _Age; } set {