Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / View / TypeToArgumentTypeConverter.cs / 1305376 / TypeToArgumentTypeConverter.cs
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Presentation.View
{
using System.Diagnostics;
using System.Globalization;
using System.Windows.Data;
using System.Activities.Presentation.Model;
using System.Runtime;
// This converter converts from InArgument, OutArgument, Activity to T
// this does not support convert back.
internal sealed class TypeToArgumentTypeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
object convertedValue = null;
Type type = value as Type;
if (type != null)
{
if (type.GetGenericArguments().Length > 0)
{
convertedValue = type.GetGenericArguments()[0];
}
}
return convertedValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw FxTrace.Exception.AsError(new NotSupportedException());
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//---------------------------------------------------------------
namespace System.Activities.Presentation.View
{
using System.Diagnostics;
using System.Globalization;
using System.Windows.Data;
using System.Activities.Presentation.Model;
using System.Runtime;
// This converter converts from InArgument, OutArgument, Activity to T
// this does not support convert back.
internal sealed class TypeToArgumentTypeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
object convertedValue = null;
Type type = value as Type;
if (type != null)
{
if (type.GetGenericArguments().Length > 0)
{
convertedValue = type.GetGenericArguments()[0];
}
}
return convertedValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw FxTrace.Exception.AsError(new NotSupportedException());
}
}
}
// 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
- CryptoStream.cs
- TextContainerChangeEventArgs.cs
- ServerIdentity.cs
- SessionStateUtil.cs
- DocumentPageView.cs
- CanExecuteRoutedEventArgs.cs
- ManagedWndProcTracker.cs
- UshortList2.cs
- ApplicationCommands.cs
- DeferredReference.cs
- ObjectSecurityT.cs
- WebEvents.cs
- CompilationUnit.cs
- PropertyEntry.cs
- Util.cs
- ExtensibleClassFactory.cs
- InvalidEnumArgumentException.cs
- FormsAuthentication.cs
- ItemCheckEvent.cs
- DesignerLoader.cs
- FontNamesConverter.cs
- MiniModule.cs
- EventBuilder.cs
- RecordsAffectedEventArgs.cs
- DataSourceExpressionCollection.cs
- EventSinkHelperWriter.cs
- PeerApplicationLaunchInfo.cs
- Vector3DIndependentAnimationStorage.cs
- FilteredAttributeCollection.cs
- Input.cs
- ResetableIterator.cs
- ReadOnlyNameValueCollection.cs
- ProfessionalColorTable.cs
- SymbolEqualComparer.cs
- SchemaNotation.cs
- StoryFragments.cs
- OleDbWrapper.cs
- Int16.cs
- XmlAttributeOverrides.cs
- DataView.cs
- BinaryReader.cs
- XmlDictionaryWriter.cs
- ChannelTracker.cs
- ComboBoxHelper.cs
- GridViewColumnCollection.cs
- SqlBuilder.cs
- IisTraceWebEventProvider.cs
- CodeExporter.cs
- XmlSchemaType.cs
- FormsAuthenticationTicket.cs
- SizeF.cs
- ISFClipboardData.cs
- TemplateAction.cs
- OdbcErrorCollection.cs
- CharacterMetricsDictionary.cs
- TimeStampChecker.cs
- StatusBarDrawItemEvent.cs
- XmlSchemaSimpleType.cs
- FileRegion.cs
- ManagementObjectSearcher.cs
- FamilyMap.cs
- InitiatorSessionSymmetricTransportSecurityProtocol.cs
- SslStreamSecurityBindingElement.cs
- TextTreeTextBlock.cs
- Add.cs
- MemoryFailPoint.cs
- ExpandCollapseProviderWrapper.cs
- Int64AnimationBase.cs
- GZipStream.cs
- ConnectionManagementSection.cs
- XhtmlBasicCommandAdapter.cs
- PeerContact.cs
- HwndAppCommandInputProvider.cs
- NetTcpSecurity.cs
- GlobalProxySelection.cs
- ApplicationFileCodeDomTreeGenerator.cs
- StringInfo.cs
- PathFigureCollection.cs
- CrossSiteScriptingValidation.cs
- DesignerTransaction.cs
- TreeIterators.cs
- ProcessHostConfigUtils.cs
- XPathArrayIterator.cs
- TransformedBitmap.cs
- EntitySetDataBindingList.cs
- RowsCopiedEventArgs.cs
- XXXInfos.cs
- LineServices.cs
- DataGridViewAdvancedBorderStyle.cs
- SystemIPInterfaceProperties.cs
- DataControlField.cs
- ResourceProviderFactory.cs
- NavigationService.cs
- CryptoConfig.cs
- WebResourceAttribute.cs
- BitmapSizeOptions.cs
- GridViewDeletedEventArgs.cs
- HtmlInputPassword.cs
- SequenceNumber.cs
- DesignerWebPartChrome.cs