Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / BooleanConverter.cs / 1 / BooleanConverter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /* */ namespace System.ComponentModel { using Microsoft.Win32; using System.Collections; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Runtime.Remoting; using System.Runtime.Serialization.Formatters; using System.Security.Permissions; ////// [HostProtection(SharedState = true)] public class BooleanConverter : TypeConverter { private static StandardValuesCollection values; ///Provides a type converter to convert /// Boolean objects to and from various other representations. ////// public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) { if (sourceType == typeof(string)) { return true; } return base.CanConvertFrom(context, sourceType); } ///Gets a value indicating whether this converter can /// convert an object in the given source type to a Boolean object using the /// specified context. ////// public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { string text = ((string)value).Trim(); try { return Boolean.Parse(text); } catch (FormatException e) { throw new FormatException(SR.GetString(SR.ConvertInvalidPrimitive, (string)value, "Boolean"), e); } } return base.ConvertFrom(context, culture, value); } ///Converts the given value /// object to a Boolean object. ////// public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { if (values == null) { values = new StandardValuesCollection(new object[] {true, false}); } return values; } ///Gets a collection of standard values /// for the Boolean data type. ////// public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) { return true; } ///Gets a value indicating whether the list of standard values returned from /// ///is an exclusive list. /// public override bool GetStandardValuesSupported(ITypeDescriptorContext context) { return true; } } }Gets a value indicating whether this object supports a standard set of values /// that can be picked from a list. ///
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CacheMemory.cs
- XmlUtil.cs
- ExcludeFromCodeCoverageAttribute.cs
- SocketAddress.cs
- AsmxEndpointPickerExtension.cs
- InkCanvasSelectionAdorner.cs
- _HelperAsyncResults.cs
- Win32Native.cs
- GroupByExpressionRewriter.cs
- SizeAnimationClockResource.cs
- MutableAssemblyCacheEntry.cs
- StrokeDescriptor.cs
- ModifierKeysValueSerializer.cs
- ListBase.cs
- StreamHelper.cs
- AudioFormatConverter.cs
- DeviceSpecificDesigner.cs
- CriticalExceptions.cs
- GridViewSelectEventArgs.cs
- WindowsAuthenticationModule.cs
- BitConverter.cs
- DecoratedNameAttribute.cs
- HostedElements.cs
- SelfIssuedAuthAsymmetricKey.cs
- PlatformCulture.cs
- TypeLoadException.cs
- TableRow.cs
- ZeroOpNode.cs
- FilterElement.cs
- ApplicationCommands.cs
- EnvironmentPermission.cs
- ErrorWrapper.cs
- Bits.cs
- MemberMaps.cs
- AsyncResult.cs
- DbLambda.cs
- GlyphingCache.cs
- List.cs
- StylusPointPropertyUnit.cs
- NativeMethods.cs
- ScriptComponentDescriptor.cs
- MaskInputRejectedEventArgs.cs
- DbConnectionPoolGroup.cs
- WebFaultException.cs
- BeginEvent.cs
- Rule.cs
- DbException.cs
- StickyNote.cs
- DataGridViewComponentPropertyGridSite.cs
- TraceUtility.cs
- BStrWrapper.cs
- WebPartDesigner.cs
- HandlerWithFactory.cs
- LZCodec.cs
- SHA256Managed.cs
- DataGridViewAddColumnDialog.cs
- GridViewColumnHeaderAutomationPeer.cs
- SystemIcmpV4Statistics.cs
- FileVersionInfo.cs
- WebPartVerb.cs
- StreamAsIStream.cs
- IDReferencePropertyAttribute.cs
- TransformedBitmap.cs
- OracleInfoMessageEventArgs.cs
- LongSumAggregationOperator.cs
- KnownTypesProvider.cs
- XmlComment.cs
- CodeComment.cs
- JoinSymbol.cs
- Sequence.cs
- TableLayoutCellPaintEventArgs.cs
- BamlTreeUpdater.cs
- RootBrowserWindow.cs
- CompleteWizardStep.cs
- DateTimeParse.cs
- sqlser.cs
- XmlSchema.cs
- VersionedStream.cs
- ReplyChannelBinder.cs
- Module.cs
- ForceCopyBuildProvider.cs
- OpCellTreeNode.cs
- MaterialGroup.cs
- Invariant.cs
- OleDbParameter.cs
- XmlUnspecifiedAttribute.cs
- EtwTrace.cs
- UnionCqlBlock.cs
- XmlStreamedByteStreamReader.cs
- EnumValAlphaComparer.cs
- FillBehavior.cs
- SpotLight.cs
- DesignTable.cs
- TableLayoutSettings.cs
- DataPagerFieldCollection.cs
- EventSetter.cs
- TraceSwitch.cs
- ValidatorCompatibilityHelper.cs
- PermissionAttributes.cs
- GeneralTransform3DTo2DTo3D.cs