Files
StockSharp/Localization/DescriptionLocAttribute.cs
T
mikasoukhov f319bcb949 S# 4.2.62
Source codes for Messages, BE, Algo, Xaml, Localization, Logging, Community and few connectors (SmartCOM, AlfaDirect, Transaq, BTCE, OpenECry, LMAX, MatLab, CQG, Sterling, RSS, Alor)
2015-02-09 14:13:43 +03:00

33 lines
933 B
C#

namespace StockSharp.Localization
{
using System;
using System.ComponentModel;
using System.Linq;
/// <summary>
/// Specifies a description for a property or event.
/// </summary>
[AttributeUsage(AttributeTargets.All)]
public class DescriptionLocAttribute : DescriptionAttribute
{
/// <summary>
/// Initializes a new instance of DescriptionLocAttribute class with description.
/// </summary>
/// <param name="resourceId">Id of string resource.</param>
/// <param name="appendDot">Append dot character ('.') at the end of description. Ignore by default.</param>
public DescriptionLocAttribute(string resourceId, bool appendDot = false)
: base(GetDescription(resourceId, appendDot))
{
}
private static string GetDescription(string resourceId, bool appendDot)
{
var desc = LocalizedStrings.GetString(resourceId);
if (appendDot && desc.Last() != '.')
desc += '.';
return desc;
}
}
}