Table of contents
TOC
Collapse the table of content
Expand the table of content

List.SingleOrDefault

Owen Duncan|Last Updated: 4/19/2018

About

Returns a single item from a list.

List.SingleOrDefault(list as list, optional default as any) as any  

Arguments

ArgumentDescription
ListThe List to check.
optional defaultSpecifies a default value to be returned.

Remarks

  • If list is empty, a default value is returned instead.

  • If default is not specified, the default value of null is assumed.

  • If list has more than one item, an error is returned.

Examples

List.SingleOrDefault({1}) equals 1  
List.SingleOrDefault({1, 2, 3}) equals error  
List.SingleOrDefault({}, 0) equals 0  
© 2018 Microsoft