Skip to content

Instantly share code, notes, and snippets.

@supreettare
supreettare / gist:43a1b3c514e7d82ee8dc002f86612bbe
Created June 7, 2017 08:37
What is the output of the program below? Explain your answer.
class Program {
private static string result;
static void Main() {
SaySomething();
Console.WriteLine(result);
}
static async Task<string> SaySomething() {
await Task.Delay(5);
@supreettare
supreettare / gist:47c0f2cfc86a2b0c0092ae03afcde969
Created June 7, 2017 08:36
Is the comparison of time and null in the if statement below valid or not? Why or why not?
static DateTime time;
/* ... */
if (time == null)
{
/* do something */
}
@supreettare
supreettare / gist:d74d352706f1a21abf9fd16f8b04081d
Created June 7, 2017 08:35
What is the output of the short program below? Explain your answer.
class Program {
static String location;
static DateTime time;
static void Main() {
Console.WriteLine(location == null ? "location is null" : location);
Console.WriteLine(time == null ? "time is null" : time.ToString());
}
}
public async Task<bool> DownloadPayload(string userId)
{
TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
ReadOnlyCollection<MobileServiceTableOperationError> syncErrors = null;
try
{
//string unique = DateTime.Now.Ticks.ToString() + DateTime.UtcNow.TimeOfDay.ToString();
// Download all user Departments
//await userDepartmentsTable.PurgeAsync();
@supreettare
supreettare / gist:62250b07d35e0aef9c553691553f188f
Created September 26, 2016 13:21
ReportStorageController
public class ReportStorageController : StorageController<Report>
{
[HttpPost]
[Route("tables/Report/{id}/StorageToken")]
public async Task<HttpResponseMessage> PostStorageTokenRequest(string id, StorageTokenRequest value)
{
StorageToken token = await GetStorageTokenAsync(id, value);
return Request.CreateResponse(token);
}
alert(7 + '7' + '7');
alert(7 + 7 + '7');
alert(7 + '7' );
alert('7' + 7 + 7);
class Taritas
{
static void Main(string[] args)
{
Y bObj= new Y(2);
Console.ReadLine();
}
}
public class X
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyClass
{
class Program
{
static void Main(string[] args)
public class Taritas
{
public int Taritas()
{
Console.WriteLine("Hi you are in class Taritas");
}
}
@supreettare
supreettare / GetCurrentLocationAndroid.cs
Created December 1, 2015 07:31
Get current location of the device using Xamarin Mobile component. This uses dependency service in Xamarin Forms. This version fixes the TaskCancelledException you generally get on Android.
public class GetCurrentLocationAndroid : IGetCurrentLocation
{
/// <summary>
/// Instance of the Geoloactor
/// </summary>
private Geolocator _locator;
/// <summary>
/// The get current location.
/// </summary>