C# 6.0 Null Propagation Operators ?. and ?[]

1
Comments
C# 6.0 Null Propagation Operators ?. and ?[]

C# 6.0 introduced two new null-propagation operators: ?. and ?[]. They will make null reference check much easier. In this article, we will see how they work and how they implemented internally. We all know about NullReferenceException and how to avoid it in our code. We just need to check everything for null before accessing some fields\properties\methods. Null Propagation Operator ?. var str = GetString(); if (str != null) { return str.Length; } else { return 0; } Now we can use Null Propagati...

Read further...

Call WCF service method from javascript (jQuery)

0
Comments

In Advanced Tic Tac Toe we have created WCF backend service and web-based frontend application. Our web application written in javascript, so we want to call WCF service methods through jQuery. There is a small instruction how-to call WCF service from javascript code. First of all you should decorate your service interface with WebInvoke attribute [OperationContract] [WebInvoke(UriTemplate = "Start", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method...

Read further...