Tag Archives: C#

Return json string with proper name

In C# 7, it is now possible to have tuple return type. You would have to use a var to store the return value. However if you simply return the var as a json, the json will be slightly messed … Continue reading

Posted in C#, Json | Tagged , | Leave a comment

Saving UI element as jpeg for Windows Phone 8.1

This is an follow-up of the Drawing pad for Windows Phone 8.1 Assume that the content that is needed to save into jpeg is in a scrollviewer, the below would be the implementation on saving the content. It works for most … Continue reading

Posted in C#, Windows Phone, winrt | Tagged , , | Leave a comment

Drawing pad for Windows Phone 8.1

Many had asked on how do we create a drawing pad for Windows Phone 8.1. It is very simple, in fact the code to get it done is exactly the same as that for Windows 8.1 In the xaml, you … Continue reading

Posted in C#, Windows Phone, winrt | Tagged , , | 3 Comments

Data Binding for Xamarin iOS

Been trying out Xamarin for iOS over the past few weeks and today I came across an article from Visual Studio Magazine that managed to explain and provide a sample code for binding data to table in iOS. The article … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Async/await not reacting as expected in Console App

If you had to use an await call in a .net Console app, you would definitely notice that the await is simply skipped over. This is because await only ensure that the rest of the code in the current async … Continue reading

Posted in C#, Console | Tagged , | Leave a comment

C# 6 Features – “Await in catch and finally blocks.”

The C# team had recently announced a few new features for C# 6 that will ships with VS 2015. One of the feature that caught my attention is “Await in catch and finally blocks.” Recall that I actually had a … Continue reading

Posted in C# | Tagged , | 1 Comment

Collection was modified; enumeration operation may not execute

Attempting to remove any element from a collection within a foreach loop will result in the above mentioned error. To stop the error simply add a .ToList() or .ToArray() within the foreach loop as seen below. List distinctList = new … Continue reading

Posted in C# | Tagged , , , | 1 Comment

await MessageDialog in the body of a catch clause

A major disadvantage of using MessageDialog is that you need to await it to show the messagebox and when often you would need to display error messages in the catch clause. In normal situation you would be doing the below: … Continue reading

Posted in C#, Windows Phone, winrt | Tagged , , , , | 5 Comments

Checking for Internet Connection

In my previous post where I had shared about checking for Network Connectivity, NetworkInterface.GetIsNetworkAvailable(), however what the method is actually doing is to simple check for network connection and not necessary internet connection. There are situation where there is network … Continue reading

Posted in C#, Windows Phone, winrt | Tagged , | Leave a comment

Additional text encountered after finished reading JSON content:

When parsing through json you may encounter the error “Additional text encountered after finished reading JSON content:”. This is usually due to incorrect json syntax. One such example that result in the above error would be {“StaffID”:”S01″,”StaffRank”:”Manager”},{“StaffID”:”S02″,”StaffRank”:”Waiter”} Surrounding the above … Continue reading

Posted in C#, Json | Tagged , , | Leave a comment