问题
I am using following code to post multiline message on facebook wall/page. but it is appear as shown in image (the text are different here). here is my code.
string path = "/me/feed";
string token = fbLoginDialog.FacebookOAuthResult.AccessToken;
dynamic messagePost = new ExpandoObject();
messagePost.message = @"Hello guys!
How are you?
Can you help me on this?";
var fb = new FacebookClient(token);
try { var postId = fb.Post(path, messagePost); }
catch (Exception ex) { MessageBox.Show(ex.Message); }
I am using Facebook.dll Version: 5.0.1.0
回答1:
Did you try Environment.NewLine?:
messagePost.message = "Hello guys!" + Environment.NewLine +
"How are you?"+ Environment.NewLine +
"Can you help me on this?";
Environment.NewLine is a platform independent property that inserts new line char for the selected environment.
Or maybe you have a problem with your syntax and it should be:
messagePost.message = @"Hello guys!\r\n How are you?\r\n Can you help me on this?";
回答2:
I got it working using Facebook.6.0.22
download latest from here https://github.com/facebook-csharp-sdk/facebook-winforms-sample
来源:https://stackoverflow.com/questions/13325543/message-with-new-line-character-is-displayed-as-html-code