Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how inspect the properties of an object where inherited to object?i can't use of Object.keys and Object.getOwnPropertyNames !

Object.keys:This method returns an array of all enumerable property names defined by a given object (inherited properties are not considered)

Object.getOwnPropertyNames:similar to Object.keys(obj) but additionally returns the names of non-enumerable properties (again, inherited properties are not included).

JavaScript
var f = new Object();
        f.l = 8;

        Object.prototype.s = 9;

        Object.defineProperty(Object.prototype, "constvar", {
            enumerable: false,
            value: 88
        });

        var g1 = Object.keys(Object);
        var gg1 = Object.getOwnPropertyNames(Object); //don't contain 'constvar' where is not enumerable but exist s property where is enumerable
Posted
Updated 17-Feb-12 0:43am
v7
Comments
krumia 17-Feb-12 6:03am    
Could you please elaborate?

1 solution

You can get those properties from the base type of a class. To get the base type: SomeObject.GetType().BaseType

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900