Note that there are some explanatory texts on larger screens.

plurals
  1. POGeneric method to recive any type of object and convert the object to a List<string>
    primarykey
    data
    text
    <p><strong>EDIT AGAIN:</strong> the solution was probably different from my original question. Thanks everyone very much your great ideas. I wish I could vote for more than one answer.</p> <p><strong>EDIT:</strong> I am populating a Jquery table plugin from datatables/.net and it requires the data (Json) to be in a certain format like this;</p> <pre><code> "sEcho": 1, "iTotalRecords": 57, "iTotalDisplayRecords": 57, "aaData": [ [ "Gecko", "Firefox 1.0", "Win 98+ / OSX.2+", "1.7", "A" ], [ "Gecko", "Firefox 1.5", "Win 98+ / OSX.2+", "1.8", "A" ], ... ] } </code></pre> <p>I am recieving data from a service that is returning a collection of object. I would like one method which I can pass these collections into and it will return the appropriate string</p> <p>thanks <strong>END EDIT</strong> I would like to build a method that can receive and object that we build and will return an array List each containing the value of each object passed in. For example;</p> <p>I have a collection of 'Car' objects </p> <p>What I would like to do is</p> <pre><code>public object[] Something&lt;T&gt;(_cars) { object[] objArray = new object[_cars.Count]; foreach(Car _car in _cars ){ IList objList = new List&lt;string&gt;; objList.Add(_car.Color); objList.Add(_car.EngineSize); //etc etc objArray[i] = objList;//i'll have to use a for loop to get the i counter but you get my idea } return objArray } </code></pre> <p>my problem is how can I access the properties of the object without knowing what type of object it is?</p> <p>thanks for any help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload