Class IEnumerableExtensions
- Namespace
- Uralstech.UCloud.TextToSpeech.Voices
Extensions for System.Collections.Generic.IEnumerable<T>.
public static class IEnumerableExtensions
- Inheritance
-
objectIEnumerableExtensions
Methods
FilterByAttributes(IEnumerable<TextToSpeechVoice>, TextToSpeechVoiceGender, TextToSpeechVoiceType)
Finds the voices with the given gender
and type
from the current collection.
public static IEnumerable<TextToSpeechVoice> FilterByAttributes(this IEnumerable<TextToSpeechVoice> thiz, TextToSpeechVoiceGender gender, TextToSpeechVoiceType type)
Parameters
thiz
IEnumerable<TextToSpeechVoice>gender
TextToSpeechVoiceGenderThe gender of the voice.
type
TextToSpeechVoiceTypeThe type of the voice.
Returns
- IEnumerable<TextToSpeechVoice>
Voices with the type and gender corresponding to
type
andgender
.
FilterByGender(IEnumerable<TextToSpeechVoice>, TextToSpeechVoiceGender)
Finds the voices with the given gender
from the current collection.
public static IEnumerable<TextToSpeechVoice> FilterByGender(this IEnumerable<TextToSpeechVoice> thiz, TextToSpeechVoiceGender gender)
Parameters
thiz
IEnumerable<TextToSpeechVoice>gender
TextToSpeechVoiceGenderThe gender of the voice.
Returns
- IEnumerable<TextToSpeechVoice>
Voices with the gender corresponding to
gender
.
FilterByType(IEnumerable<TextToSpeechVoice>, TextToSpeechVoiceType)
Finds the voices with the given type
from the current collection.
public static IEnumerable<TextToSpeechVoice> FilterByType(this IEnumerable<TextToSpeechVoice> thiz, TextToSpeechVoiceType type)
Parameters
thiz
IEnumerable<TextToSpeechVoice>type
TextToSpeechVoiceTypeThe type of the voice.
Returns
- IEnumerable<TextToSpeechVoice>
Voices with the type corresponding to
type
.
FindByAttributes(IEnumerable<TextToSpeechVoice>, TextToSpeechVoiceGender, TextToSpeechVoiceType)
Finds the voice with the given gender
and type
from the current collection.
public static TextToSpeechVoice FindByAttributes(this IEnumerable<TextToSpeechVoice> thiz, TextToSpeechVoiceGender gender, TextToSpeechVoiceType type)
Parameters
thiz
IEnumerable<TextToSpeechVoice>gender
TextToSpeechVoiceGenderThe gender of the voice.
type
TextToSpeechVoiceTypeThe type of the voice.
Returns
- TextToSpeechVoice
A voice with the type and gender corresponding to
type
andgender
, null if not found.
FindByAttributes(IEnumerable<TextToSpeechVoice>, TextToSpeechVoiceGender, params TextToSpeechVoiceType[])
Finds the first voice with the given gender
and one of the specified types
,
where the order of types in types
specifies preference.
public static TextToSpeechVoice FindByAttributes(this IEnumerable<TextToSpeechVoice> thiz, TextToSpeechVoiceGender gender, params TextToSpeechVoiceType[] types)
Parameters
thiz
IEnumerable<TextToSpeechVoice>The collection of voices to search within.
gender
TextToSpeechVoiceGenderThe gender to filter by.
types
TextToSpeechVoiceType[]The types to filter by. Order indicates preference.
Returns
- TextToSpeechVoice
The first voice matching the gender and one of the specified types, or null if none is found.
Remarks
The method searches the collection and returns the first voice that matches the gender and any of the provided types, preferring the order in which the types are listed.
FindByGender(IEnumerable<TextToSpeechVoice>, TextToSpeechVoiceGender)
Finds the voice with the given gender
from the current collection.
public static TextToSpeechVoice FindByGender(this IEnumerable<TextToSpeechVoice> thiz, TextToSpeechVoiceGender gender)
Parameters
thiz
IEnumerable<TextToSpeechVoice>gender
TextToSpeechVoiceGenderThe gender of the voice.
Returns
- TextToSpeechVoice
A voice with the gender corresponding to
gender
, null if not found.
FindByName(IEnumerable<TextToSpeechVoice>, TextToSpeechVoiceName)
Finds the voice with the given name
from the current collection.
public static TextToSpeechVoice FindByName(this IEnumerable<TextToSpeechVoice> thiz, TextToSpeechVoiceName name)
Parameters
thiz
IEnumerable<TextToSpeechVoice>name
TextToSpeechVoiceNameThe name of the voice.
Returns
- TextToSpeechVoice
A voice with the name corresponding to
name
, null if not found.
FindByType(IEnumerable<TextToSpeechVoice>, TextToSpeechVoiceType)
Finds the voice with the given type
from the current collection.
public static TextToSpeechVoice FindByType(this IEnumerable<TextToSpeechVoice> thiz, TextToSpeechVoiceType type)
Parameters
thiz
IEnumerable<TextToSpeechVoice>type
TextToSpeechVoiceTypeThe type of the voice.
Returns
- TextToSpeechVoice
A voice with the type corresponding to
type
, null if not found.