FileFormat.GetFormatByExtension

FileFormat.GetFormatByExtension method

Gets the preferred file format from the file extension name The extension name should starts with a dot(’.’).

public static FileFormat GetFormatByExtension(string extensionName)
ParameterTypeDescription
extensionNameString

Return Value

Instance of FileFormat, otherwise null returned.

Examples

The following code shows how to save scene to memory using specified format

Scene scene = new Scene(new Box());
var outputFormat = ".glb";
var format = FileFormat.GetFormatByExtension(outputFormat);
using(var ms = new MemoryStream())
{
    scene.Save(ms, format);
}

See Also