Class CommentCreationBuilder
Implements the ICommentCreationBuilder interface to create a CommentCreation object.
Inherited Members
Namespace: Unity.Cloud.Annotation.Runtime
Syntax
public class CommentCreationBuilder : ICommentCreationBuilder
Examples
public async Task<IComment> CreateCommentOnTopic(ITopic topic,
string commentText)
{
ICommentCreationBuilder commentCreationBuilder = new CommentCreationBuilder();
commentCreationBuilder.SetText(commentText);
ICommentCreation commentCreation = commentCreationBuilder.GetCommentCreation();
IComment createdComment = await topic.CreateCommentAsync(commentCreation);
return createdComment;
}
Constructors
CommentCreationBuilder()
Initializes and returns an instance of CommentCreationBuilder.
Declaration
public CommentCreationBuilder()
Methods
GetCommentCreation()
Returns the instance of the CommentCreation that is being built.
Declaration
public ICommentCreation GetCommentCreation()
Returns
| Type | Description |
|---|---|
| ICommentCreation | The instance of the CommentCreation that is being built. |
Implements
Examples
public ICommentCreation GetCommentCreation(string commentText)
{
ICommentCreationBuilder commentCreationBuilder = new CommentCreationBuilder();
commentCreationBuilder.SetText(commentText);
return commentCreationBuilder.GetCommentCreation();
}
SetText(String)
Assigns a value to the Text property of the CommentCreation that is being built.
Declaration
public ICommentCreationBuilder SetText(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| String | text | The new Text value. |
Returns
| Type | Description |
|---|---|
| ICommentCreationBuilder | The current instance of the ICommentCreationBuilder interface. |
Implements
Examples
public async Task<IComment> CreateCommentOnTopic(ITopic topic,
string commentText)
{
ICommentCreationBuilder commentCreationBuilder = new CommentCreationBuilder();
commentCreationBuilder.SetText(commentText);
ICommentCreation commentCreation = commentCreationBuilder.GetCommentCreation();
IComment createdComment = await topic.CreateCommentAsync(commentCreation);
return createdComment;
}