BlueSky.Model.VirtualListDynamic.GetRowData C# (CSharp) Method

GetRowData() private method

private GetRowData ( object row ) : string[]
row object
return string[]
        internal string[] GetRowData(object row)//My function to get single row at once
        {
            int fIndex = (int)row;
            //Using R.Net's DataFrame
            if (fIndex < 0)// R's 1 based index is made zero based but for accidental zero we must not decrease value further
                return null;
            //fIndex--;
            CommandRequest cr = new CommandRequest();
            string rcommand = string.Empty;
            object datobj = null;
            int colcount = _dataSource.Variables.Count;
            string[] rdata = new string[colcount];
            for (int i = 0; i < colcount; i++)
            {
                if (_DF != null)// this check for avoiding crash - IndexOutOfBounds
                {
                    if(fIndex < _DF.RowCount && i < _DF.ColumnCount)
                    {
                        if (_DF[fIndex, i] != null)
                        {
                            if (_DF[fIndex, i].ToString() == "NaN" || _DF[fIndex, i].ToString() == "NA" || //-2147483648 for NA
                               _DF[fIndex, i].ToString().Trim().Equals("-2147483648"))// || _DF[fIndex, i].ToString() == "<NA>")
                            {
                                rdata[i] = "<NA>";
                            }
                            else
                            {
                                if ((_dataSource.Variables[i].DataClass.Equals("POSIXct") ||
                                    _dataSource.Variables[i].DataClass.Equals("POSIXlt")
                                    ))
                                {
                                    //rcommand = "as.character(as.POSIXct(as.numeric(" + _DF[fIndex, i].ToString() + "),origin = '1970-01-01', tz = 'GMT'))";
                                    //cr.CommandSyntax = rcommand;
                                    //try
                                    //{

                                    //    datobj = null;// _service.ExecuteR(cr, true, false);
                                    //   rdata[i] = datobj != null?datobj.ToString():"1970-01-01";
                                    //}
                                    //catch (Exception ex)
                                    //{
                                    //    if (ex != null)
                                    //    { }
                                    //}
                                    rdata[i] = _DF[fIndex, i].ToString();
                                }
                                else if(_dataSource.Variables[i].DataClass.Equals("Date"))
                                {
                                    int adddays =0;
                                    DateTime begindt = Convert.ToDateTime("01/01/1970");
                                    DateTime dt2=Convert.ToDateTime("01/01/1970");
                                    if( Int32.TryParse(_DF[fIndex, i].ToString(), out adddays))
                                    {
                                         dt2 = begindt.AddDays(adddays);
                                    }
                                    rdata[i] = dt2.ToString();
                                }
                                else
                                {
                                    rdata[i] = _DF[fIndex, i].ToString();
                                }
                            }
                        }
                        else // ie.. _DF[fIndex, i] == null. ( This is null when factor col has <NA> in R). That should be NaN but dont know why its null.
                        {
                            rdata[i] = "<NA>";
                        }
                    }
                }
                else
                    rdata[i] = "<NA>";
            }
            return rdata;
        }