XApps.WebApi.Areas.HelpPage.HelpPageSampleGenerator.GetSampleObject C# (CSharp) 메소드

GetSampleObject() 공개 메소드

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.
리턴 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;
        }