XApps.WebApi.Areas.HelpPage.HelpPageSampleGenerator.GetSampleObject C# (CSharp) Méthode

GetSampleObject() public méthode

Gets the sample object that will be serialized by the formatters. First, it will look at the SampleObjects. If no sample object is found, it will try to create one using ObjectGenerator.
public GetSampleObject ( Type type ) : object
type System.Type The type.
Résultat object
        public virtual object GetSampleObject(Type type)
        {
            object sampleObject;

            if (!SampleObjects.TryGetValue(type, out sampleObject))
            {
                // Try create a default sample object
                ObjectGenerator objectGenerator = new ObjectGenerator();
                sampleObject = objectGenerator.GenerateObject(type);
            }

            return sampleObject;
        }