.net-2.0

Adding custom class objects to listbox in c#

三世轮回 提交于 2019-12-10 19:26:16
问题 i have a class which looks like this public class Process_Items { String Process_Name; int Process_ID; //String Process_Title; public string ProcessName { get { return Process_Name; } set { this.Process_Name = value; } } public int ProcessID { get { return Process_ID; } set { this.Process_ID = value; } } } now i want to create a Process_Items[] Array and display all the elements in a multi column listbox. Such that first column must have the processName and 2nd must have the processID. How

Unit Testing using InternalsVisibleToAttribute requires compiling with /out:filename.ext?

时光怂恿深爱的人放手 提交于 2019-12-10 19:05:22
问题 In my most recent question: Unit Testing Best Practice? / C# InternalsVisibleTo() attribute for VBNET 2.0 while testing?, I was asking about InternalsVisibleToAttribute. I have read the documentation on how to use it, and everything is fine and understood. However, I can't instantiate my class Groupe from my Testing project. I want to be able to instantiate my internal class in my wrapper assembly, from my testing assembly. Any help is appreciated! EDIT #1 Here's the compile-time error I get

Upgrade from .NET 2.0 to .NET 3.5 problems

﹥>﹥吖頭↗ 提交于 2019-12-10 18:47:35
问题 I’m trying to upgrade our solution from VS2005 .NET 2.0 to VS2008 .NET 3.5. I converted the solution using VS2008 conversion wizard. All the projects (about 50) remained targeting to .NET Framework 2.0., moreover if I’m changing target framework manually for one of the projects, all referenced dll (i.e. System, System.Core, System.Data, etc. are still pointing to Framework 2.0. The only way to completely change targeting framework I found is to remove these references and refer them again

Possible to overwrite items in IEnumerable<T> using Reflection?

风流意气都作罢 提交于 2019-12-10 18:25:18
问题 Disregarding any sane reason to do this, and simply out of curiosity Is it possible to take any given IEnumerable(T) and overwrite the contained items? For example, given an IEnuemrable(String) is it possible to completely replace all strings within the IEnumerable? 回答1: As other people have said, if the IEnumerable is something concrete like a List or a Collection, Set, etc, then you can do this without reflection - just cast it to that type and mess with it. What if the IEnumerable is

How to serialize to dateTime

牧云@^-^@ 提交于 2019-12-10 17:30:37
问题 Working to get DateTimes for any time zone. I'm using DateTimeOffset, and a string, and an XmlElement attribute. When I do, I get the following error: [InvalidOperationException: 'dateTime' is an invalid value for the XmlElementAttribute.DataType property. dateTime cannot be converted to System.String.] System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel,

VS2008 targeting .NET 2.0 doesn't stop me from using C# 3 features

喜夏-厌秋 提交于 2019-12-10 17:16:38
问题 I had a VS2005 solution and wanted to get off VS2005 for the new year. I was mostly happy with the upgrade process and pleasantly surprised to see that my build scripts mostly still worked. My question is around the multi-targeting feature - I don't have .NET 3.5 installed on my servers, so I have to continue to target .NET 2.0. That worked, mostly, but I found that I could do things like var returnMe = "result: " + result.ToString(); ...and still debug the project successfully. When I got

Connect to FTP Server with .net 2.0 [closed]

自作多情 提交于 2019-12-10 16:29:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I'm looking to connect to an existing FTP server, upload a file, wait while the server generates a report on it, and download that report back to the local machine in a VB.NET 2.0 WinForms project. Is there an existing FTP library that would be helpful to me for this? My task seems simple enough that I'd rather

VB.Net calling New without assigning value

白昼怎懂夜的黑 提交于 2019-12-10 15:57:55
问题 In C# I can do this: new SomeObjectType("abc", 10); In other words, I can call new without assigning the created instance to any variable. However, in VB.Net it seems I cannot do the same thing. New SomeObjectType("abc", 10) ' syntax error Is there a way to do this in VB.Net ? 回答1: See the answers to this other SO Answer So this should work: With New SomeObjectType("abc", 10) End With 回答2: The following works on the Mono VB compiler ( vbnc , version 0.0.0.5914, Mono 2.4.2 - r): Call New

Linking to a .Net v2.0 assembly from a .Net v4.0 assembly also appears to link (and alias) mscorlib v2.0. Why?

荒凉一梦 提交于 2019-12-10 15:43:19
问题 I have a .Net assembly which imports an assembly linked against the v2.0 runtime. The problem I'm having is that when I try to run some tests on my assembly, Fusion trys to load the wrong version of a dependent assembly. After looking at the assembly manifest, I can see why: the wrong version of FSharp.Core is linked. In my build file, I make FSharp.Core, Version=4.0.0.0 explicit, but FSharpPowerPack appears to link to v2.0.0.0, and some how seems to "win" this linking battle. Here's the

Quick way to turn object into single-element list?

混江龙づ霸主 提交于 2019-12-10 15:17:37
问题 What is the quickest in C# 2.0 to create a one-element list out of a single object? eg: MyObject obj = new MyObject(); List<MyObject> list = new List<MyObject> { obj }; // is this possible? 回答1: Your sample code List<MyObject> list = new List<MyObject> { obj }; uses a collection initializer, which was not available in C# 2.0. You could use an array initializer, instead: List<MyObject> list = new List<MyObject>(new MyObject[] { obj }); Or, just make the list and add the object: List<MyObject>