Sitecore 5.0 API

MainUtil.GetNextVarNameSequence Method 

Gets next value of the variable name sequencer, optionally resetting it if it has reached a certain maximum.

[Visual Basic]
Public Shared Function GetNextVarNameSequence( _
   ByVal max As Integer _
) As Integer
[C#]
public static int GetNextVarNameSequence(
   int max
);

Return Value

The next value of the sequencer.

Remarks

This function is threadsafe and can be used to generate unique variable names. The sequencer is incremented before the value is returned.

Example

  string list = "";

  for(int n = 0; n < 5; n++) {
    list += "id" + MainUtil.GetNextVarNameSequence(10000).ToString() + ",";
  }
  
  // id12,id13,id14,id15,id16

See Also

MainUtil Class | Sitecore Namespace | GetNextSequence