I want to turn a messageResponse from a protocol buffer into a
IEnumerable<messageResponse>
so in the service will return me an IEnumerable<messageResponse>
Proto I have:
syntax = "proto3";
option csharp_namespace = "ProjectName.Protos";
package Banana;
service Banana {
rpc GetAllBananas (MessageRequest) returns (ListBananasResponse);
}
//How to Turn this to IEnumerable<> ?
message ListBananasResponse{
string bananaName = 1;
string bananaInfo = 2;
}
message MessageRequest{
string message = 1;
}
And this is my the BananaService.cs
using Grpc.Core;
using ProjectName.Protos;
namespace ProjectName.Services
{
public class BananaService : Banana.BananaBase
{
//The Method should return a IEnumerable list of bananas
//want to do Task<IEnumerable<ListBananasResponse>>
public override Task<ListBananasResponse> GetAllBananas(MessageRequest request,
ServerCallContext context)
{
var lstbananas = new IEnumerable<ListBananasResponse>();
return lstbananas;
}
}
Is there any way to do this and if so, how to do it? (I'm Using C# .Net6)
Any answer is welcome :)