Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / System.Runtime.DurableInstancing / System / Runtime / NameGenerator.cs / 1305376 / NameGenerator.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Runtime
{
using System;
using System.Globalization;
using System.Threading;
class NameGenerator
{
static NameGenerator nameGenerator = new NameGenerator();
long id;
string prefix;
NameGenerator()
{
this.prefix = string.Concat("_", Guid.NewGuid().ToString().Replace('-', '_'), "_");
}
public static string Next()
{
long nextId = Interlocked.Increment(ref nameGenerator.id);
return nameGenerator.prefix + nextId.ToString(CultureInfo.InvariantCulture);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Runtime
{
using System;
using System.Globalization;
using System.Threading;
class NameGenerator
{
static NameGenerator nameGenerator = new NameGenerator();
long id;
string prefix;
NameGenerator()
{
this.prefix = string.Concat("_", Guid.NewGuid().ToString().Replace('-', '_'), "_");
}
public static string Next()
{
long nextId = Interlocked.Increment(ref nameGenerator.id);
return nameGenerator.prefix + nextId.ToString(CultureInfo.InvariantCulture);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TreeNode.cs
- Style.cs
- DispatcherHooks.cs
- UdpContractFilterBehavior.cs
- DateTime.cs
- HtmlElementEventArgs.cs
- ModelPropertyCollectionImpl.cs
- NamedElement.cs
- SafeNativeMethods.cs
- PolicyManager.cs
- HelpProvider.cs
- PropertyGridCommands.cs
- XPathEmptyIterator.cs
- _NtlmClient.cs
- SQLDecimalStorage.cs
- ObjectViewListener.cs
- DbQueryCommandTree.cs
- DbParameterCollectionHelper.cs
- DodSequenceMerge.cs
- UIAgentMonitor.cs
- UndoManager.cs
- TransformationRules.cs
- XmlToDatasetMap.cs
- FilterElement.cs
- UnsafeNativeMethodsMilCoreApi.cs
- OdbcConnectionString.cs
- SingleTagSectionHandler.cs
- TextRange.cs
- WebConfigurationHostFileChange.cs
- Int32EqualityComparer.cs
- DataListAutoFormat.cs
- MimeWriter.cs
- PluralizationService.cs
- BaseCAMarshaler.cs
- TextEditorTables.cs
- SerializationEventsCache.cs
- GridEntry.cs
- BufferBuilder.cs
- Label.cs
- ThreadPoolTaskScheduler.cs
- LockedAssemblyCache.cs
- CutCopyPasteHelper.cs
- ParsedAttributeCollection.cs
- TextDecorationLocationValidation.cs
- DoubleAnimationUsingKeyFrames.cs
- SinglePageViewer.cs
- IndexedString.cs
- LogSwitch.cs
- DispatcherSynchronizationContext.cs
- ClientUriBehavior.cs
- X509ServiceCertificateAuthentication.cs
- TargetFrameworkUtil.cs
- OptimisticConcurrencyException.cs
- TableCell.cs
- ApplicationBuildProvider.cs
- TransformerInfo.cs
- SQLBytes.cs
- OleDbStruct.cs
- PropertyRecord.cs
- DesignerExtenders.cs
- ProxyWebPart.cs
- BackEase.cs
- Environment.cs
- TextTreeInsertElementUndoUnit.cs
- UIElementHelper.cs
- DrawingGroupDrawingContext.cs
- PointValueSerializer.cs
- ConnectionPool.cs
- DSACryptoServiceProvider.cs
- prefixendpointaddressmessagefilter.cs
- StaticExtensionConverter.cs
- ReadOnlyCollection.cs
- HandlerBase.cs
- DocumentPageView.cs
- ScaleTransform3D.cs
- SimpleWorkerRequest.cs
- SchemaNames.cs
- XmlAttributeCollection.cs
- DoubleAnimationBase.cs
- ADMembershipUser.cs
- ViewGenerator.cs
- ConfigXmlAttribute.cs
- WrappingXamlSchemaContext.cs
- FastEncoderWindow.cs
- CultureInfoConverter.cs
- SelectManyQueryOperator.cs
- NavigationHelper.cs
- Root.cs
- Size3DValueSerializer.cs
- ClientBuildManager.cs
- Geometry.cs
- CalloutQueueItem.cs
- LineGeometry.cs
- ObfuscationAttribute.cs
- SqlFileStream.cs
- DataBindingHandlerAttribute.cs
- OpenTypeLayout.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- HtmlEmptyTagControlBuilder.cs
- DocumentXPathNavigator.cs