HelpPageSampleGenerator.GetSampleObject Method

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 DefaultSampleObjectFactory (which wraps an ObjectGenerator) and other factories in SampleObjectFactories.
<SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
            Justification = "Even if all items in SampleObjectFactories throw, problem will be visible as missing sample.")> _ 
Public Overridable Function GetSampleObject( _ 
ByVal type As Type
) As Object
This language is not supported or no code example is available.
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
            Justification = "Even if all items in SampleObjectFactories throw, problem will be visible as missing sample.")] 
public virtual object GetSampleObject( 
Type type 
)
This language is not supported or no code example is available.
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
            Justification = "Even if all items in SampleObjectFactories throw, problem will be visible as missing sample.")] 
public:  
virtual object^ GetSampleObject( 
Type^ type 
)
This language is not supported or no code example is available.
public  
SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Even if all items in SampleObjectFactories throw, problem will be visible as missing sample.") 
function GetSampleObject( 
type : Type 
) : object;
This language is not supported or no code example is available.

Parameters

type
Type

The type.

Return Value

object

The sample object.

.NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

In this article

Definition