Ok i am going through Saplo Api C# project. It stump me when i saw these code:
public class Helper
{
private static int _currentId;
public static int GetCurrentId()
{
return _currentId;
}
public static int GetNextId()
{
return ++_currentId;
}
}
[DataContract]
internal class RequestBase<T>
{
public RequestBase()
{
ID = Helper.GetNextId().ToString(CultureInfo.InvariantCulture);
}
public RequestBase(string method, T @params)
: this()
{
Method = method;
Parameters = @params;
}
[DataMember(Name = "id")]
public string ID { get; private set; }
[DataMember(Name = "method")]
public string Method { get; set; }
[DataMember(Name = "params")]
public T Parameters { get; set; }
}
So if you look at the constructor for RequestBase.... public RequestBase()! you will see Helper.GetNextId() this only return an int why bother using CultureInfo.InvariantCulture i dont understand why a simple ToString inst good enough to do the job or what, isnt this is just more overhead?