public CollectionValueBridge(RewriteDesign design, TypeBridge collectionType, TypeBridge itemType, ValueBridge name, bool reuse) : base(collectionType, name) { ItemType = itemType; if (collectionType.Type is ArrayTypeSyntax) { CollectionType = CollectionType.Array; } else { var displayString = collectionType.Type.ToString(); if (displayString.StartsWith("LinqRewrite.Core.SimpleList.SimpleList<")) { CollectionType = CollectionType.SimpleList; } else if (displayString.StartsWith("System.Collections.Generic.List<")) { CollectionType = CollectionType.List; } else if (displayString.StartsWith("System.Collections.Generic.IList<")) { CollectionType = CollectionType.IList; } else { CollectionType = CollectionType.IEnumerable; } } Count = CodeCreationService.CreateCollectionCount(Value, CollectionType); if (CollectionType == CollectionType.IEnumerable) { return; } if (reuse) { Value = name.ReusableConst(design, Type, CollectionType == CollectionType.SimpleList ? true : (bool?)null); } if (reuse) { Count = Count.ReusableConst(design, Int); } }
public TypedValueBridge(TypeBridge type, LocalVariable variable) : base(variable) { Type = type; Value = variable; }
public TypedValueBridge(TypeBridge type, ValueBridge name) : base(name) { Type = type; Value = name; }