Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Base / MS / Internal / NamedObject.cs / 1 / NamedObject.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Description: Placeholder object, with a name that appears in the debugger
//
//---------------------------------------------------------------------------
using System;
using System.Globalization;
using MS.Internal.WindowsBase;
namespace MS.Internal
{
///
/// An instance of this class can be used wherever you might otherwise use
/// "new Object()". The name will show up in the debugger, instead of
/// merely "{object}"
///
[FriendAccessAllowed] // Built into Base, also used by Framework.
internal class NamedObject
{
public NamedObject(string name)
{
if (String.IsNullOrEmpty(name))
throw new ArgumentNullException(name);
_name = name;
}
public override string ToString()
{
if (_name[0] != '{')
{
// lazily add {} around the name, to avoid allocating a string
// until it's actually needed
_name = String.Format(CultureInfo.InvariantCulture, "{{{0}}}", _name);
}
return _name;
}
string _name;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Description: Placeholder object, with a name that appears in the debugger
//
//---------------------------------------------------------------------------
using System;
using System.Globalization;
using MS.Internal.WindowsBase;
namespace MS.Internal
{
///
/// An instance of this class can be used wherever you might otherwise use
/// "new Object()". The name will show up in the debugger, instead of
/// merely "{object}"
///
[FriendAccessAllowed] // Built into Base, also used by Framework.
internal class NamedObject
{
public NamedObject(string name)
{
if (String.IsNullOrEmpty(name))
throw new ArgumentNullException(name);
_name = name;
}
public override string ToString()
{
if (_name[0] != '{')
{
// lazily add {} around the name, to avoid allocating a string
// until it's actually needed
_name = String.Format(CultureInfo.InvariantCulture, "{{{0}}}", _name);
}
return _name;
}
string _name;
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- QueryableDataSourceView.cs
- DecimalStorage.cs
- DataServiceProcessingPipelineEventArgs.cs
- HierarchicalDataSourceIDConverter.cs
- Camera.cs
- SqlFunctions.cs
- StylusPointPropertyId.cs
- DocumentViewerConstants.cs
- Validator.cs
- RepeatBehaviorConverter.cs
- SerializerWriterEventHandlers.cs
- OrderByLifter.cs
- WebConvert.cs
- MembershipPasswordException.cs
- RelationalExpressions.cs
- DataViewListener.cs
- AutoCompleteStringCollection.cs
- OracleConnectionStringBuilder.cs
- VisualStyleTypesAndProperties.cs
- WebPartAuthorizationEventArgs.cs
- UserPersonalizationStateInfo.cs
- HitTestParameters3D.cs
- SizeConverter.cs
- DragEvent.cs
- LoginName.cs
- TrustSection.cs
- StrokeNodeData.cs
- PeerChannelFactory.cs
- BufferBuilder.cs
- TextHidden.cs
- NamespaceEmitter.cs
- BaseTemplateBuildProvider.cs
- thaishape.cs
- ResourceProviderFactory.cs
- MailWriter.cs
- ScrollProviderWrapper.cs
- RegexWriter.cs
- SystemIcons.cs
- HtmlInputCheckBox.cs
- ToolStripItem.cs
- NativeMethods.cs
- SqlCacheDependencyDatabase.cs
- ExpressionHelper.cs
- RectAnimation.cs
- ObjectCloneHelper.cs
- _StreamFramer.cs
- _PooledStream.cs
- TraceContextRecord.cs
- StringFunctions.cs
- AndCondition.cs
- FrameworkElement.cs
- Misc.cs
- LicFileLicenseProvider.cs
- WorkItem.cs
- ArrayTypeMismatchException.cs
- SequentialActivityDesigner.cs
- WindowsButton.cs
- ProcessThread.cs
- CacheDict.cs
- HtmlElement.cs
- Main.cs
- SqlFormatter.cs
- SerialPort.cs
- ProfileElement.cs
- OrderedDictionary.cs
- BindValidationContext.cs
- CacheEntry.cs
- CalendarDateRangeChangingEventArgs.cs
- StylusButtonEventArgs.cs
- XmlSchemaAttribute.cs
- TrackingMemoryStream.cs
- InputLanguageEventArgs.cs
- SpeechSeg.cs
- EmptyStringExpandableObjectConverter.cs
- CompilationAssemblyInstallComponent.cs
- SafeNativeMethods.cs
- EntityConnection.cs
- DeclaredTypeElementCollection.cs
- TextSpanModifier.cs
- QuaternionRotation3D.cs
- BaseInfoTable.cs
- RoutedUICommand.cs
- OneOfTypeConst.cs
- DaylightTime.cs
- FontStretches.cs
- EventRouteFactory.cs
- PlaceHolder.cs
- SecUtil.cs
- TextModifierScope.cs
- XmlSchemaSimpleTypeList.cs
- SecureStringHasher.cs
- WebPartVerb.cs
- ControlValuePropertyAttribute.cs
- Panel.cs
- TypeInformation.cs
- PlatformNotSupportedException.cs
- ServiceEndpointElementCollection.cs
- ConsumerConnectionPointCollection.cs
- PassportAuthenticationModule.cs
- bidPrivateBase.cs