Method argument like "{0}"

Posted by Nerdanalysis under C# on 1/4/2013 | Points: 10 | Views : 867 | Status : [Member] | Replies : 3
hi all,

In the following code what could be "{0}".

pagerFormat = Link.ToCategory(departmentId, categoryId, "{0}")

When we put the argument in "{ }"

Thank in advance




Responses

Posted by: Shubham on: 1/4/2013 [Member] Starter | Points: 25

Up
0
Down
Can u give more description about your code???????????

Thanks&Regards:-
Shubham Choudhary
Software Engineer
www.facebook.com/shubham.kunar

Nerdanalysis, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nerdanalysis on: 1/4/2013 [Member] Starter | Points: 25

Up
0
Down
Thank Shubham for having a look....


if (categoryId != null)
{
// Retrieve list of products in a category
list.DataSource =
CatalogAccess.GetProductsInCategory(categoryId, page, out howManyPages);
list.DataBind();
// get first page url and pager format
firstPageUrl = Link.ToCategory(departmentId, categoryId, "1");
pagerFormat = Link.ToCategory(departmentId, categoryId, "{0}");
}

and called function is :-

public static string ToCategory(string departmentId, string categoryId, string page)
{
if (page == "1")
return BuildAbsolute(String.Format("Catalog.aspx?DepartmentID={0}&CategoryID={1}", departmentId, categoryId));
else
return BuildAbsolute(String.Format("Catalog.aspx?DepartmentID={0}&CategoryID={1}&Page={2}", departmentId, categoryId, page));
}

public static string ToCategory(string departmentId, string categoryId)
{
return ToCategory(departmentId, categoryId, "1");
}

Nerdanalysis, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shubham on: 1/4/2013 [Member] Starter | Points: 25

Up
0
Down
this is show u.....
The Main method can be declared with or without a string[] parameter that contains command-line arguments. When using Visual Studio to create Windows Forms applications, you can add the parameter manually or else use the Environment class to obtain the command-line arguments. Parameters are read as zero-indexed command-line arguments. Unlike C and C++, the name of the program is not treated as the first command-line argument.

Thanks&Regards:-
Shubham Choudhary
Software Engineer
www.facebook.com/shubham.kunar

Nerdanalysis, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response