Along with the nameof operator, C# 6.0 also introduced Null-Conditional operator that enable developers to check the null value with in an object reference chain. The null – conditional operator ( ?.) , returns null if anything in the object reference chain in null. This avoid checking null for each and every nested objects if they […]
C# 6.0 introduced a new operator named, nameof that accepts the name of code element and returns a string literal of the same element. The nameof operator can take as a parameter like class name and its all members like method, variables, properties and return the string literal. This avoids having hardcoded strings to be […]
Using Async methods are very common now a days and while working with async and await, you may have experienced that you want to put some of the result awaiting either in a catch or finally block or in both. Consider a scenario, when there is an exception and you want to log information into file or sending […]
So far we have seen, Property can be initialized only in the constructor, and if it has any backing field defined, that can be initialized where it is declared. C# 6.0 introduced a new features called “Auto-Property initializer” that allows property to be initialized like fields in the same line where it has been declared.
Formatting the string values are very common during development. We generally use String.Format() method, that replaces each format item in a specified string with the text equivalent values from the objects. While this is a common, sometimes this is confusing and produce error. Because, we need to specific the place holder for each item and […]
C# 6.0 introduced many small and useful features that helps developers to write clean code. On of such feature is “Using Statement with Static Classes”. We know a static class cannot be instantiated. While using any static member, we find ourselves repeating the class name to access any of the static members. It looks kind […]
Well, while being in touch with a number of developers, I always find people don’t understand the real meaning of disposing objects. Lets clear our basic understanding on why we need to dispose objects in .NET before understanding the usefulness of Using block. Why Disposing is necessary ? We all know, the code that we […]
You might have developed many projects and want to deploy them to the clients but want to avoid having number of entry point for the application. You can build a master application which can invoke all these small tools to ensure the entry point is hooked to one single executable. Here is a solution to it.
As we saw in the previous post, that you can programmatically change the Lock screen of the Phone from an app which supports extension of Lock Screen defined in the Metadata file, we can also open various settings screen directly from within the app as well. To open an existing settings applet, you need to […]