Click or drag to resize

LanguageFactoryFindById Method

Find a language using his id, return null if not found

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public static ILanguage FindById(
	IContext context,
	int id
)

Parameters

context
Type: AskiaPortalCmnIContext
Context of execution
id
Type: SystemInt32
Id of the language to find

Return Value

Type: ILanguage
Return null if the language was not found
Examples

Find the language using his id

var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));   
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
    throw contextValidation.Exception;
}
var language = LanguageFactory.FindById(context, context.User.LanguageId);
if (language != null)
{
    Console.WriteLine("The user uses the {0} (id={1}) langage", language.Name, language.Id);
}
else
{
    Console.WriteLine("The specified language was not found.");
}
See Also