简体   繁体   中英

Facebook API in a console application

I am new to using Facebook Api and I am using it in visual studio C# , and I downloaded it's library facebook. But I want to know how to start work on it ? Should I use Windows form for it or Console is fine ? Because I just want to Update my status through Api , getting my friend list , read my statuses . As I run this code before but It didn't show me the output

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Facebook;    

namespace Social_network_work
{
    class Program
    {
        static void Main(string[] args)
        {
            var client = new FacebookClient();
            dynamic me = client.Get("totten");
        }
    }
}

as I am python user but now I have to use visual studio c#. "http://csharpsdk.org/" this link is not showing how to use it in windows 7

Your question doesn't have much to do with Windows 7.

You sample works fine. You just don't have any line writting to the console. Try :

var client = new FacebookClient();
var me = client.Get("totten");

Console.WriteLine(me);

To keep the command-line open so you can read the output, add the following after the Console.Writeline line

Console.Readline();

Then when you run it, the output will display, and wait for you to press enter - which will allows the program to continue and exit/quit.

Also, in short, yes you should be able to create the app as a complete command-line application without issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM