So actually you're using WCF to create a REST service. I've read what you mean in the answer to the question you're creating a possible duplicate of: How to have optional parameters in WCF REST service?
You can get the desired effect by omitting the Query string from the UriTemplate on your WebGet or WebInvoke attribute, and using WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters
.
So what that'd come down to is:
Change your method's signature to omit the parameter:
CityNewsList GetNewsByCity(string DeviceType,string id /*,string limit*/);
Change the attributes so that the parameter is not expected on the query string:
[OperationContract]
[WebGet(UriTemplate = "/whatever/{DeviceType}/{id}", RequestFormat = WebMessageFormat.Xml)]
instead of
[OperationContract]
[WebGet(UriTemplate = "/whatever/{DeviceType}/{id}/{limit}", RequestFormat = WebMessageFormat.Xml)]
In the end you'd have something like:
[OperationContract]
[WebGet(UriTemplate = "/whatever/{DeviceType}/{id}", RequestFormat = WebMessageFormat.Xml)]
CityNewsList GetNewsByCity(string DeviceType,string id);
And the implementation's first thing to do would be:
string limit = WebOperationContext.Current.IncomingRequest.UriTemplateMatch.QueryParameters["Limit"];
However: I have not tried that, but that's what I understand from what you've quoted in the comments to your question.