Click or drag to resize
TypeExtensionsIsSimpleType Method
Checks if the specified type is a type which should not be traversed when building an object hiararchy.

Namespace: Griffin
Assembly: Griffin.Core (in Griffin.Core.dll) Version: (
public static bool IsSimpleType(
	this Type type


Type: SystemType
Type to check

Return Value

Type: Boolean
true if it's a simple type; otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Type. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
public string Build(object instance)
    var sb = new StringBuilder();
    Build(instance, "", sb);
    return sb.ToString();

protected void Build(object instance, string prefix, StringBuilder result)
    foreach (var propInfo in instance.GetType().GetProperties())
        if (instance.GetType().IsSimpleType())
            var value = propInfo.GetValue(instance, null);
            result.AppendLine(prefix + propInfo.Name + ": " + value);
            var newPrefix = prefix == "" ? propInfo.Name : prefix + ".";

while (!type.IsSimpleType())
See Also