C# Tip’s and Tricks




    Are you interested in developing apps for Windows phone and Windows 8 and you already got the skills to code in Java.

    After few years developing in Java, I have finally decided to switch to C# with .net Framework. There are several reasons for this decision which I will going to explain in this series.

    Every time I talk to students on creating  apps, I kept hearing the same thing which they don’t know how to code in C#.

    This is why I'm going to show some tips and trick’s to code in C# from a Java projective .

    Take in mind that you can actually develop an app for Windows 8  in either C# , C++ or even JavaScript and HTML5. Learn more here

    Check out this useful book that I read by Rob Miles called C Sharp from Java Orange Book.that shows you how to code C# from a Java projective.

    Keep tuned as I will be posting Tip’s biweekly every Thursday.

    Tip #1

    Simple Class


     1: class Student{
     2: private string name;
     4: public Student (String Name)
     5: {
     6:     name = Name;
     7: }
     9: public void setname (String Name)  //Set
     10: {
     11:     name = Name;
     12: }
     14: public string getname () //Get
     15: {
     16:     return name;
     17: }
     19: }

    P.S If you tried to copy this code to a C# app, It will totally work.


     1: class Studnet 
     2: {
     4: public string name {set; get;}
     6: public Student (string Name)
     7: {
     8:     name = Name;
     9: }
     11: }

    As you can see, I needed only 4 lines of code in C# where as 9 in Java.

    One last thing , If you started coding in C#  and you got some tips that you would like to share , let me know and maybe we can share your experience.You can reach me at  t-ramdeb@microsoft.com

  • Go DevMENTAL

    HTML5 for Internet Explorer and Windows 8


    cadhtml5coaMicrosoft really jumped on the HTML5 bandwagon in a big way with Internet Explorer 9 and now Windows 8, so how does this affect your sites and apps?

    There are really two big Microsoft platforms where you can leverage HTML5:

    • Internet Explorer 9 & 10
    • Windows 8

    Internet Explorer 9 & 10

    When Internet Explorer 9 came out, many a web developer was pleased to see HTML5 support. The more browsers that support HTML5 the less we have to write different code for different browsers. Internet Explorer 10 supports even more HTML5 features than IE 9! You can check out all sorts of great examples of the HTML5 features at ietestdrive.com you will also find a few sites on there which will even help you write your CSS and HTML5 Code. As a programmer, nothing I like better than cut and paste! Start exploring HTML5 features (WOFF rocks) and use them in your code today. I know not every browser supports everything yet, so you will want some feature detection and fallback code for older browsers, but you should be preparing your sites for the newest browsers, so those who do have new browsers have the best possible experience! Here are 4 basic steps you can do right now to get your web sites ready for IE 9 and IE 10!

    1. Update your docmode for web standards
    2. Run Compat Inspector to fix common IE problems
    3. Implement feature detection to support many browsers (We recommend using Modernizr)
    4. Create a plug-in free browsing experience for Windows 8 users

    Windows 8

    Usually when we think of developing Windows applications we think of Visual Basic, C#, and Windows Presentation Foundation. Windows 8 still supports developing with .NET and XAML (Silverlight and Windows Presentation Foundation are both based on XAML) but it also provided a new option, HTML5/CSS and JavaScript. That way developers with experience developing web sites can leverage their existing skills to build cool Windows 8 apps and games without having to learn a new programming language. HTML5 isn’t a second class citizen on Windows 8 either, with the WinRT you can leverage all sorts of great APIs, the same APIs that are available to the .NET and C++ developers. The WinRT is written in C++ but when you call it from your JavaScript you can’t tell. You can check out Dev.windows.com to find out more about building Windows 8 apps with HTML5.

    I have a dream…a dream where I write code once, just once, for multiple platforms and browsers … maybe we are getting a little closer.

  • Go DevMENTAL

    Great Windows 8 Apps != Complex Code


    Windows 8 Start ScreenWhen you use the power of the WinRT you can build some pretty amazing apps without requiring complex code. Leverage the code that’s already there to get a great app in the store early!

    When you are deploying an app to the store it’s better to have Timer than Timer698. Getting in the store early can make a difference. In Canada, the app excellence labs give you the earliest chance to publish to the store. But with the labs coming up in June, you may think you can’t build a decent app in time. Fair enough, some of you may have some amazing ideas that will take some time to develop. But there is so much you can do with a simple idea when you add the capabilities of WinRT.

    My kids have been playing computer games since they were 12 months old. As a parent I was always on the lookout for fun or educational computer games. One of the most common games was the match game. You have 4, 16, or 25 cards flipped upside down, you have to flip the cards over and find the matching pairs. This would be easy enough to build on Windows 8, but how do we take a simple app and bring that to the next level without a lot of work?  leverage WinRT!

    • How about using the File Pickers to let the player pick their own photos to use for the cards. Find the matching pictures of daddy, or your pet dog Kibbles.
    • How about letting players take new pictures with the webcam using Media.Capture? My kids would have happily sat on an airplane sticking out their tongue and making silly faces at a webcam, holding up their favourite stuffed animals, and plastic dinosaurs, to customize the cards in a match game.

    Media.capture was the first WinRT API I learned how to use! it’s become the Hello World of WinRT. After a little searching on dev.windows.com you will find everything you need to get started: You can download a sample app in C++, C# or Javascript; You can follow a Quickstart on capturing a photo with the camera dialog or using the MediaCapture API.

    Not every great app requires 3-6 months development time. You can build apps that will surprise and delight users in under a week with the help of WinRT and a little imagination. It’s also a great chance to learn more about the Windows 8 platform and how to publish apps to the store before you release *the* big app you are working on. Don’t miss out on your chance to be first to the store. Get coding, and contact Win8CDN@Microsoft.com to request a session either in person or remotely in one of the app excellence labs and get your app in the store.

    One last thing, if you decide to build and publish the match game I described above, let me know, I know some kids who will want to try it!

  • Go DevMENTAL

    McGill students providing rural health care with a phone, Windows 8 and the cloud


    223MicroImagCup-223At the Canadian Imagine Cup, two students from McGill university try to address the challenge of providing healthcare in rural areas using a Windows Phone application, the cloud, and a Windows 8 application. Their solution earned them 3rd place at the Canadian Imagine Cup Finals.

    The Problem:

    India is one of the world’s largest countries, home to over a billion people. It is also one of the poorest countries, over 72% of the population live in villages. Rural India has very poor healthcare, 43$ have no access to healthcare. 70% have no resident doctor and 80% of medical workers are unqualified.

    The Solution:

    Connect doctors and patients, provide an easy way for patients to express their symptoms and provide an infrastructure for doctors to diagnose rural patients and recommend appropriate actions.

    Technologies Used:

    Windows Phone, Windows 8 and SQL Azure

    What did they do?

    Abhijeet Kalyan and Shravan Narayan from McGill university came up with project Neem, a rural healthcare solution. The solution revolves around a village healthcare worker. You find someone in the village who is respected in the community, and is computer literate to act as the village healthcare worker. You provide them with some very basic medical training and a Windows Phone. Using the Windows Phone they can scan the national id card of a patient. Any stored information about the patient is retrieved. The village healthcare worker has enough training to take a temperature, check blood sugar levels, check a pulse or blood pressure. These vitals can be recorded in the phone application. The health care worker can also record any particular symptoms the patient reports by tapping the area of the body and selecting the symptoms


    image image

    The patient data is stored in SQL Azure and then accessed by doctors in the city through a Windows 8 application. The doctors can review the patients symptoms and recommend appropriate treatment. With the Skype application on Windows Phone, the team is also considering adding a Skype option for direct patient to doctor or doctor to healthcare worker interaction.

    Shravan and Abhijeet also see a bigger picture of using the data generated from the application to help public health organizations, governments and aid agencies. A desktop data analytics application could help interpret the data and identify trends while still keeping patient information anonymous. Perhaps helping agencies identify what diseases are diagnosed in different regions.

    Rural healthcare isn’t just a challenge in India, this is a challenge we face in Canada as well, as many doctors feel they will have a higher quality of life setting up practice in the city leaving small towns woefully short of desperately needed medical services. Hopefully the work done by these students will be the beginning of a solution.

  • Go DevMENTAL

    Imagine Cup = Inspiration – Thank you Canada!


    Don’t let anyone tell you what you cannot do, get inspired from students who show you what you can do!

    One year ago, I saw a video of students at the 2011 Imagine Cup Finals in New York City. It was inspiring. All too often we are told what we cannot do. But all it takes to make a change is a small group of committed people. When the opportunity arose to host Canadian Imagine Cup finals I seized the opportunity! With the help of an incredible group of people we held the finals at the end of April. I wanted to share with you the video from our Canadian finals. Let’s stop telling people what they can’t do, and help people realize what they can do! Thank you to everyone who was a part of this year’s Imagine Cup and especially to every student who entered, you are an inspiration to us all! 

    Planning is already underway for next year. Look out world, Canada is out to show you what we can do! Follow us on facebook to make sure you are first to know about Imagine Cup 2013.

Page 1 of 3 (15 items) 123