.net

Abstract class or interface. Which way is correct?

孤者浪人 提交于 2021-02-17 22:17:38
问题 There are two way for choosing between abstract class or interface. Microsoft solution and Oracle solution: Microsoft, design guideline: Do use abstract (MustInherit in Visual Basic) classes instead of interfaces to decouple the contract from implementations. http://msdn.microsoft.com/en-us/library/ms229013.aspx Oracle, The Java Tutorials: If an abstract class contains only abstract method declarations, it should be declared as an interface instead. http://docs.oracle.com/javase/tutorial/java

Is MEF or MEF2 baked into the .NET Framework?

£可爱£侵袭症+ 提交于 2021-02-17 21:58:22
问题 I am trying to understand MEF and I am seeing references to MEF and MEF 2. This site lists MEF2 as being much faster than MEF (4.0). I need to understand what I am talking about when most people say MEF. So which is in the .NET Framework 4.5? MEF or MEF2? 回答1: Well to make it even more confusing Microsoft released three versions of MEF using two only unique names: MEF and MEF2 System.ComponentModel.Composition.* MEF in .NET 4 (typically called just MEF), no support for CompositionScopes,

Is MEF or MEF2 baked into the .NET Framework?

僤鯓⒐⒋嵵緔 提交于 2021-02-17 21:58:10
问题 I am trying to understand MEF and I am seeing references to MEF and MEF 2. This site lists MEF2 as being much faster than MEF (4.0). I need to understand what I am talking about when most people say MEF. So which is in the .NET Framework 4.5? MEF or MEF2? 回答1: Well to make it even more confusing Microsoft released three versions of MEF using two only unique names: MEF and MEF2 System.ComponentModel.Composition.* MEF in .NET 4 (typically called just MEF), no support for CompositionScopes,

Can I configure the DataContractSerializer to not create optional (i.e. Nullable<> and List<>) elements in output XML?

大憨熊 提交于 2021-02-17 21:41:07
问题 I am using the new .NET 3.0 DataContractSerializer. I have both Nullable< > and List< > objects I am going to serialize. Example: [DataContract(Namespace = "")] class Test { public static void Go() { Test test = new Test(); var dcs = new DataContractSerializer(typeof(Test)); dcs.WriteObject(new StreamWriter("test.xml").BaseStream, test); } [DataMember] public Nullable<int> NullableNumber = null; [DataMember] public int Number = 5; [DataMember] public List<int> Numbers = new List<int>(); }

Can I configure the DataContractSerializer to not create optional (i.e. Nullable<> and List<>) elements in output XML?

拜拜、爱过 提交于 2021-02-17 21:39:54
问题 I am using the new .NET 3.0 DataContractSerializer. I have both Nullable< > and List< > objects I am going to serialize. Example: [DataContract(Namespace = "")] class Test { public static void Go() { Test test = new Test(); var dcs = new DataContractSerializer(typeof(Test)); dcs.WriteObject(new StreamWriter("test.xml").BaseStream, test); } [DataMember] public Nullable<int> NullableNumber = null; [DataMember] public int Number = 5; [DataMember] public List<int> Numbers = new List<int>(); }

How to convert an existing assembly to a ms unit test assembly?

隐身守侯 提交于 2021-02-17 21:16:04
问题 In Visual Studio 2010 Pro, how can I easily convert a classic assembly to a ms unit test assembly ? It there a flag to activate in the .csproj file ? 回答1: The problem is that test projects are "marked" on the project file - you can convert a class library to Test project follow these four simple steps: Unload the project (.prj) file and then open it for update. add the following line to the project C#: <Project> <PropertyGroup> <AssemblyName>....</AssemblyName> <!-- add this line below -->

How to convert an existing assembly to a ms unit test assembly?

耗尽温柔 提交于 2021-02-17 21:11:27
问题 In Visual Studio 2010 Pro, how can I easily convert a classic assembly to a ms unit test assembly ? It there a flag to activate in the .csproj file ? 回答1: The problem is that test projects are "marked" on the project file - you can convert a class library to Test project follow these four simple steps: Unload the project (.prj) file and then open it for update. add the following line to the project C#: <Project> <PropertyGroup> <AssemblyName>....</AssemblyName> <!-- add this line below -->

How to convert an existing assembly to a ms unit test assembly?

雨燕双飞 提交于 2021-02-17 21:10:56
问题 In Visual Studio 2010 Pro, how can I easily convert a classic assembly to a ms unit test assembly ? It there a flag to activate in the .csproj file ? 回答1: The problem is that test projects are "marked" on the project file - you can convert a class library to Test project follow these four simple steps: Unload the project (.prj) file and then open it for update. add the following line to the project C#: <Project> <PropertyGroup> <AssemblyName>....</AssemblyName> <!-- add this line below -->

How to change the Public token of the assembly

旧巷老猫 提交于 2021-02-17 16:36:23
问题 I have two assemblies. One assembly is referring to the another one. I checked the manifest of first assembly and found it is referencing to the second one with some specific token key. But I checked the token of second assembly and found that it has a different public token. So somehow I missed the correct second assembly. So I want to know is there a way I can change the second assembly's public token to the one which first assembly needs. Also I have another second assembly also which has

How to change the Public token of the assembly

拜拜、爱过 提交于 2021-02-17 16:36:18
问题 I have two assemblies. One assembly is referring to the another one. I checked the manifest of first assembly and found it is referencing to the second one with some specific token key. But I checked the token of second assembly and found that it has a different public token. So somehow I missed the correct second assembly. So I want to know is there a way I can change the second assembly's public token to the one which first assembly needs. Also I have another second assembly also which has