Posts

.Net Contravariance & Covariance notes

Variant == Contravariant or Covariant. Invariant == NOT (Contravariant or Covariant) All next members of an interface will result in compilation errors. interface IVariant < out TReturn , in TArgument > {     // CS1961 Invalid variance:     // The type parameter 'TReturn' must be contravariantly valid on 'IVariant<TReturn, TArgument>.SetA(TReturn)'.     // 'TReturn' is covariant.     void SetA( TReturn smpleArg);     // CS1961 Invalid variance:     // The type parameter 'TArgument' must be covariantly valid on 'IVariant<TReturn, TArgument>.GetA()'.     // 'TArgument' is contravariant.     TArgument GetA();     // CS1961 Invalid variance:     // The type parameter 'TArgument' must be covariantly valid on 'IVariant<TReturn, TArgument>.GetASetR(TReturn)'.     // 'TA...

How to invoke an event handlers asynchronously

How to invoke an event or delegate handlers asynchronously Variant with the  Parallel class (TPL). public void OnMyEvent( String myValue) {     var multiCastDelegate = Interlocked .CompareExchange( ref MyEvent, null , null );     if (multiCastDelegate == null )      {         return ;      }     var handlers = multiCastDelegate.GetInvocationList()         .Cast< EventHandler < MyEventArgs >>();     var args = new MyEventArgs (myValue);     Parallel .ForEach(         handlers,         handler => handler( this , args)); }   Old variant with the Asynchronous delegates (APM). public void OnMyEventOld( String myValue) {     var multiCastDelegate = Interlocked .CompareExc...

Binding lack of the Silverlight DataGrid CellTemplate

Be aware of this. Silverlight 5. DataGrid DataGridTemplateColumn.CellTemplate Visibility (!!!) It doesn’t work, at all: Visibility ="{ Binding  Path = Detail,  Converter ={ StaticResou rce  VisibleNonEmptyConverter }} " This is working: Visibility ="{ Binding  Path = DataContext,  RelativeSource ={ R elativeSource  Self },  Converter ={ StaticResource   VisibleNonEmptyConverter }}" DataContext ="{ Binding  Path = Detail}" < data : DataGrid                ItemsSource ="{ Binding  Path = Items}"                AutoGenerateColumns ="False"                HeadersVisibility ="None"                Background ="Transparent"  ...

Projects list

My modest projects. Formatted Input MVVM Workflow Close the ChildWindow by its Overlay MathNullable The Prism architecture lack for the Interactions! WcfContext - The Custom WCF Context State Pattern Implementation WorkflowCode - Workflow in a Code framework WPF application Single Instance in one line of code for usage

How to enable World Wide Services (IIS) in the Windows Firewall for arbitrary ports

The predefined rules in the Windows Firewall have the fixed ports: World Wide Web Services (HTTP Traffic-In) - 80 World Wide Web Services (HTTPS Traffic-In) - 443 You should create your own rule and apply it for (!!!) all programs. Thanks for details from: Why does it have "Apply to all programs and services" and not just the "World Wide Web Publishing Service / W3SVC"? How to enable “World Wide Services (HTTP)” in the firewall using command line?

Books and valuable articles

TODO It's empty. Advice is appreciated. In progress Introduction to RX Done The Little MongoDB Book , Karl Seguin RX MSDN Code Generation and T4 Text Templates

C# inner object’s touch notation.

The notation will not create or change the internal object. That's it var  obj =  new   Obj        {               Inner = {CompanyName =  "Any name" }        }; Required that the inner object was created before of use. The full example:         class   Program        {               static   void  Main()              {                      var  obj =  new   Obj                            {      ...