These are chat archives for Nethereum/Nethereum

Apr 2017
Lucas Cullen
Apr 13 2017 06:46
Thanks Juan!
Apr 13 2017 10:52
Hello, I have a question regarding returning 'address[]' from a contract function. What does that map to in C#? Do I need to use a DTO? Thanks
Here is the .sol code:
    function getTokenTypesForAccount(address adr) returns (address[])
        return tokenHolders[adr];
Juan Blanco
Apr 13 2017 11:44
a string[]
Apr 13 2017 14:36

@juanfranblanco Thanks, that's what I thought, but if I call it like this:
var result = await getTokenTypesForAccountFunction.CallAsync<string[]>(tokenOwnerAddress);
I get an exception:

System.MissingMethodException : No parameterless constructor defined for this object.
Stack Trace:
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Nethereum.ABI.Decoders.ArrayTypeDecoder.DecodeStaticElementType(Byte[] encoded, Type type)
   at Nethereum.ABI.Decoders.ArrayTypeDecoder.Decode(Byte[] encoded, Type type)
   at Nethereum.ABI.Decoders.DynamicArrayTypeDecoder.Decode(Byte[] encoded, Type type)
   at Nethereum.ABI.ABIType.Decode(Byte[] encoded, Type type)
   at Nethereum.ABI.FunctionEncoding.ParameterDecoder.DecodeOutput(String output, ParameterOutput[] outputParameters)
   at Nethereum.ABI.FunctionEncoding.FunctionCallDecoder.DecodeSimpleTypeOutput[T](Parameter outputParameter, String output)
   at Nethereum.Web3.FunctionBase.<CallAsync>d__26`1.MoveNext()

What am I missing? Thanks

Apr 13 2017 15:08
hello, I am trying to get 2d array as function result. I have solidity function - function getFlags() constant returns (bool[2][] res) and c# - await getResultsFunction.CallAsync<bool[][]>(). But it returns null. Is it possible to return 2d arrays from the contract?