.net-4.5

Switch-Case on Class.PropertyName (not value)

泄露秘密 提交于 2021-02-06 09:22:09
问题 I have a class which implements INotifyPropertyChanged like this: public class Person : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; string _color; public string Color { get{ return _color; } set { _color = value; RaisePropertyChanged(); } } ... private void RaisePropertyChanged([CallerMemberName]string prop = "") { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(prop)); } } When the Color property setter is called, it

Gen2 collection not always collecting dead objects?

被刻印的时光 ゝ 提交于 2021-02-04 10:39:50
问题 By monitoring the CLR #Bytes in all Heaps performance counter of a brand new .NET 4.5 server application over the last few days, I can notice a pattern that makes me think that Gen2 collection is not always collecting dead objects, but I am having trouble understanding what exactly is going on. Server application is running in .NET Framework 4.5.1 using Server GC / Background. This is a console application hosted as a Windows Service (with the help of Topshelf framework) The server

Why does converting between decimal and hex throw a formatexception?

时间秒杀一切 提交于 2021-01-29 07:46:26
问题 When I compile and run the below code, it throws the following exception: Unhandled Exception: System.FormatException: The specified format 'X' is invalid at System.NumberFormatter.NumberToString (System.String format, System.Globalization.NumberFormatInfo nfi) [0x00000] in :0 at System.NumberFormatter.NumberToString (System.String format, Decimal value, IFormatProvider fp) [0x00000] in :0 at System.Decimal.ToString (System.String format, IFormatProvider provider) [0x00000] in :0 at System

Can .NET 4.5 assemblies reference .NET 4.0 assemblies?

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-29 03:53:39
问题 I'm thinking about using Awesomium.NET for a project I'm working on which is built with .NET 4.5. Awesomium.NET targets the .NET 4.0 Client Profile. Will it be OK to reference the 4.0 libraries from a 4.5 project? 回答1: That should be fine, both .Net 4.0 and .Net 4.5 use CLR 4. 回答2: In general, assemblies compiled in .NET 1.1 or later can be referenced in higher runtime (CLR) versions. However, you cannot reference an assembly compiled in 4.0 in runtime 3.0 来源: https://stackoverflow.com

Can .NET 4.5 assemblies reference .NET 4.0 assemblies?

半城伤御伤魂 提交于 2021-01-29 03:50:57
问题 I'm thinking about using Awesomium.NET for a project I'm working on which is built with .NET 4.5. Awesomium.NET targets the .NET 4.0 Client Profile. Will it be OK to reference the 4.0 libraries from a 4.5 project? 回答1: That should be fine, both .Net 4.0 and .Net 4.5 use CLR 4. 回答2: In general, assemblies compiled in .NET 1.1 or later can be referenced in higher runtime (CLR) versions. However, you cannot reference an assembly compiled in 4.0 in runtime 3.0 来源: https://stackoverflow.com

How to implement Command Pattern with async/await

£可爱£侵袭症+ 提交于 2021-01-24 05:25:17
问题 i'm currently upgrading some existing code for use by windows universal and am struggling to convert a command pattern to work with the new async/await functionality. I have a command scheduler class that runs within its own thread and processes commands that have been added to its queue. The method in question looks like this: private List<ICommandItem> _items; private void ProcessCommands() { while(_items.count > 0) { _items[0].Execute(); _items.RemoveAt(0); } } My problem is that some of

How to implement Command Pattern with async/await

瘦欲@ 提交于 2021-01-24 05:23:43
问题 i'm currently upgrading some existing code for use by windows universal and am struggling to convert a command pattern to work with the new async/await functionality. I have a command scheduler class that runs within its own thread and processes commands that have been added to its queue. The method in question looks like this: private List<ICommandItem> _items; private void ProcessCommands() { while(_items.count > 0) { _items[0].Execute(); _items.RemoveAt(0); } } My problem is that some of

How to implement Command Pattern with async/await

人走茶凉 提交于 2021-01-24 05:21:33
问题 i'm currently upgrading some existing code for use by windows universal and am struggling to convert a command pattern to work with the new async/await functionality. I have a command scheduler class that runs within its own thread and processes commands that have been added to its queue. The method in question looks like this: private List<ICommandItem> _items; private void ProcessCommands() { while(_items.count > 0) { _items[0].Execute(); _items.RemoveAt(0); } } My problem is that some of

How to implement Command Pattern with async/await

旧街凉风 提交于 2021-01-24 05:20:51
问题 i'm currently upgrading some existing code for use by windows universal and am struggling to convert a command pattern to work with the new async/await functionality. I have a command scheduler class that runs within its own thread and processes commands that have been added to its queue. The method in question looks like this: private List<ICommandItem> _items; private void ProcessCommands() { while(_items.count > 0) { _items[0].Execute(); _items.RemoveAt(0); } } My problem is that some of