Google.Protobuff timestamp.proto in c#
c#, protocol-buffers
Solution
Timestamp is class so you have to create it first like this:
test._timeStamp = new Timestamp() { Seconds = DateTime.Now.Second }
Problem
I have successfully compiled my .proto file with google.proto.Timestamp and generated the .cs file with protoc. The only problem i am having is initialization in my c# code. I have tried the following: .proto File ``` message teststamp { string Name = 1 ; string address = 2; google.protobuf.Timestamp _timeStamp = 3; } ``` C# File ``` teststamp test = new teststamp(); test.Name = "Test"; test.address = "Test_Test_TEST" //Example 2 : POSIX test._timeStamp.Seconds = DateTime.Now.Second; test._timeStamp.Nanos = DateTime.Now.Second*1000 ; ``` The above is compiling without errors but giving me this error: `Object reference not set to an instance of an object` .I have tried few other approaches but due to less help it is unable to fix the error. Please help me out in this issue Thanks