In The Hand
GetMultiLanguageStringAttributeById Method (id, language)
NamespacesInTheHand.Net.BluetoothServiceRecordGetMultiLanguageStringAttributeById(ServiceAttributeId, LanguageBaseItem)
.NET Components for Mobility
Gets a String containing the value of the TextString service attribute with the specified ID, using the specified natural language.
Declaration Syntax
C#Visual Basic
public string GetMultiLanguageStringAttributeById(
	ServiceAttributeId id,
	LanguageBaseItem language
)
Public Function GetMultiLanguageStringAttributeById ( _
	id As ServiceAttributeId, _
	language As LanguageBaseItem _
) As String
Parameters
id (ServiceAttributeId)
The id of the service attribute to locate, as a ServiceAttributeId.
language (LanguageBaseItem)
Which multi-language version of the string attribute to locate.
Return Value

[Missing <returns> documentation for "M:InTheHand.Net.Bluetooth.ServiceRecord.GetMultiLanguageStringAttributeById(InTheHand.Net.Bluetooth.ServiceAttributeId,InTheHand.Net.Bluetooth.LanguageBaseItem)"]

Remarks

As noted in the documentation on this class, string are defined in an odd manner, and the multi-language strings defined in the base SDP specification are defined in a very very odd manner. The natural language and the string’s encoding are not included in the element, but instead are defined in a separate element, and the ID of the string attribute is modified. This pair is present for each natural language.

This method is provided to simplify accessing those strings, given the Language attribute it should use it to find and decode the string. If the primary Language attribute is to be used, then use the GetPrimaryMultiLanguageStringAttributeById(ServiceAttributeId) method that takes only the id parameter.

Examples
C#:
CopyC#
LanguageBaseItem primaryLang = record.GetPrimaryLanguageBaseItem();
if (primaryLang == null) {
  Console.WriteLine("Primary multi-language not present, would have to guess the string's encoding.");
  return;
}
try {
  String sn = record.GetMultiLanguageStringAttributeById(UniversalAttributeId.ServiceName, primaryLang);
  Console.WriteLine("ServiceName: " + sn);
} catch (KeyNotFoundException) {
  Console.WriteLine("The record has no ServiceName Attribute.");
}
Exceptions
ExceptionCondition
KeyNotFoundException There is no attribute with the given Id in the record. Throws ArgumentException in NETCFv1
InvalidOperationException The service element is not of type TextString.
DecoderFallbackException If the value in the service element is not a valid string in the encoding specified in the given LanguageBaseItem.

Assembly: InTheHand.Net.Personal (Module: InTheHand.Net.Personal) Version: 3.0.0.0