actionscript 3 - I have a piece of server-client code, however this bit is in AS3 and I'm working in C#. Can someone help me translate it? -


i've been working on converting old server flash game can use starting point new server-client system, hit stopping point can't figure out. can @ code , possibly translate c#?

var dists:array = []; for(a=0;a<deltas.length;a++) {     dists.push({offset:math.abs(deltas[a]-avg),                  time:deltas[a],                  tostring:function(){                      return "offset:" +                       this.offset + ",                       time: " + this.time }                }) } 

as note, these numbers doubles - aside int in loop. , further clarification, dists i've translated double list array, might wrong. have far:

list<double> dist = new list<double>();  (int = 0; < deltas.count; i++) {     dist.add(math.abs(deltas[i] - average)); } 

from information given, work out...

void main() {     dictionary<int, double> deltas = new dictionary<int, double>();     int avg = 0;      list<item> dists = new list<item>();     (int = 0; < deltas.count(); a++)     {         dists.add(new item { offset = math.abs(deltas[a] - avg), time = deltas[a].todatetime()});     } }  public class item  {     public double offset { get; set; }     public datetime time { get; set; }     public string displaystring { get; set; }      public override string tostring()     {         return string.format("offset: {0}, time: {1}", this.offset, this.time);     } }  public static class extension {     public static datetime todatetime(this double time)     {         return new datetime(1970, 1, 1, 0, 0, 0, datetimekind.utc).addseconds(time);     } } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -