Here are the examples of the csharp api System.Collections.Generic.IEnumerable.AsEnumerable() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1130 Examples
19
Source : Html.cs
with MIT License
from benjamin-hodgson
with MIT License
from benjamin-hodgson
public static Html SelfClosingTag(string name, params Attr[] attrs)
=> SelfClosingTag(name, attrs.AsEnumerable());
19
Source : Html.cs
with MIT License
from benjamin-hodgson
with MIT License
from benjamin-hodgson
public static Html _(List<Html> siblings)
=> _(siblings.AsEnumerable());
19
Source : Html.cs
with MIT License
from benjamin-hodgson
with MIT License
from benjamin-hodgson
public static TagBuilder Tag(string name, params Attr[] attrs)
=> Tag(name, attrs.AsEnumerable());
19
Source : Html.cs
with MIT License
from benjamin-hodgson
with MIT License
from benjamin-hodgson
public static Html Tag_(string name, params Html[] children)
=> Tag_(name, children.AsEnumerable());
19
Source : TagBuilder.cs
with MIT License
from benjamin-hodgson
with MIT License
from benjamin-hodgson
public Html _(params Html[] children)
=> _(children.AsEnumerable());
19
Source : Parser.Char.cs
with MIT License
from benjamin-hodgson
with MIT License
from benjamin-hodgson
public static Parser<char, char> AnyCharExcept(params char[] chars)
{
if (chars == null)
{
throw new ArgumentNullException(nameof(chars));
}
return AnyCharExcept(chars.AsEnumerable());
}
19
Source : TryTests.cs
with MIT License
from benjamin-hodgson
with MIT License
from benjamin-hodgson
[Fact]
public void TestEnumerator()
{
DoTest((p, x) => p.Parse(x), x => x, x => x.AsEnumerable());
}
19
Source : CodeMatcher.cs
with MIT License
from BepInEx
with MIT License
from BepInEx
public IEnumerable<CodeInstruction> InstructionEnumeration()
{
return codes.AsEnumerable();
}
19
Source : Transpilers.cs
with MIT License
from BepInEx
with MIT License
from BepInEx
public static IEnumerable<CodeInstruction> Manipulator(this IEnumerable<CodeInstruction> instructions,
Func<CodeInstruction, bool> predicate, Action<CodeInstruction> action)
{
if (predicate is null)
throw new ArgumentNullException(nameof(predicate));
if (action is null)
throw new ArgumentNullException(nameof(action));
return instructions.Select(instruction =>
{
if (predicate(instruction))
action(instruction);
return instruction;
}).AsEnumerable();
}
19
Source : RedisDataManager.cs
with MIT License
from berdon
with MIT License
from berdon
public Task<IEnumerable<RedisValue>> GetQueueMessagesAsync(int count)
{
var startTime = DateTimeOffset.UtcNow;
try
{
if (_droppedMessagesCount > 0)
{
_logger.Warning("Dropped {Count} messages on the floor due to overflowing cache size", _droppedMessagesCount);
_droppedMessagesCount = 0;
}
if (_queue.Count <= 0) return Task.FromResult(EmptyRedisValueEnumerable);
if (count < 0 || count == UnlimitedMessageCount)
{
count = _queue.Count;
}
var items = new List<RedisValue>();
while(items.Count < count && _queue.TryDequeue(out var item))
{
items.Add(item);
}
_logger.Debug("Retrieved {Count} messages", items.Count);
return Task.FromResult(items.AsEnumerable());
}
catch (Exception exc)
{
ReportErrorAndRethrow(exc);
throw; // Can't happen
}
finally
{
CheckAlertSlowAccess(startTime);
}
}
19
Source : ConnectionViewModel.cs
with MIT License
from Berrysoft
with MIT License
from Berrysoft
public Task DropAsync(params IPAddress[] ips) => DropAsync(ips.AsEnumerable());
19
Source : ConnectionViewModel.cs
with MIT License
from Berrysoft
with MIT License
from Berrysoft
public Task ConnectAsync(params IPAddress[] ips) => ConnectAsync(ips.AsEnumerable());
19
Source : ProcessingPipelineBuilder.cs
with GNU General Public License v3.0
from Bililive
with GNU General Public License v3.0
from Bililive
public ProcessingDelegate Build()
=> this.rules.AsEnumerable().Reverse().Aggregate((ProcessingDelegate)(_ => { }), (i, o) => o(i));
19
Source : XSigTokenStreamWriter.cs
with MIT License
from bitm0de
with MIT License
from bitm0de
public void WriteXSigData(XSigToken[] tokens)
{
WriteXSigData(tokens.AsEnumerable());
}
19
Source : Program.cs
with MIT License
from bjorkstromm
with MIT License
from bjorkstromm
static async Task Main(string[] args)
{
using (var writer = new StringWriter())
{
// Gazorator.Default
// .WithOutput(writer)
// .WithModel(new Model
// {
// MyProperty = 1234,
// Values = new List<int> { 1, 2, 3, 4 }
// }).ProcessAsync("./Views/Sample.cshtml").Wait();
// await Gazorator.Default
// .WithOutput(writer)
// // .WithModel(new BindingProjectModel())
// // .WithReferences(typeof(XDoreplacedent).replacedembly)
// //.ProcessAsync("./Views/Xamarin.cshtml")
// .WithModel(new Model
// {
// MyProperty = 1234,
// Values = new List<int> {1, 2, 3, 4}
// })
// .ProcessTemplateAsync(template);
var issue = new Cake.Issues.Issue(
"id",
"path",
"projectName",
"affectedPath",
1,
2,
1,
2,
"text",
"html",
"markdown",
1,
"prio",
"rule",
new Uri("http://example.com"),
"run",
"providerType",
"providerName");
await Gazorator.Default
.WithOutput(writer)
.WithModel(new [] { issue }
.AsEnumerable()
.Cast<Cake.Issues.IIssue>())
.WithReferences(
typeof(Cake.Issues.IIssue).replacedembly,
typeof(Cake.Issues.Reporting.IIssueReportFormat).replacedembly,
typeof(Cake.Issues.Reporting.Generic.DevExtremeTheme).replacedembly,
typeof(Cake.Core.IO.FilePath).replacedembly
)
// .WithViewBag(ViewBag =>
// {
// ViewBag.replacedle = "Foo";
// })
.WithViewBag(new Dictionary<string, object>
{
["replacedle"] = "FooBar"
})
.ProcessAsync("./Views/CakeIssues.cshtml");
System.Console.WriteLine(writer.ToString());
}
}
19
Source : DefaultSignProvider.cs
with GNU Affero General Public License v3.0
from blockbasenetwork
with GNU Affero General Public License v3.0
from blockbasenetwork
public Task<IEnumerable<string>> GetAvailableKeys()
{
return Task.FromResult(Keys.Keys.AsEnumerable());
}
19
Source : DefaultSignProvider.cs
with GNU Affero General Public License v3.0
from blockbasenetwork
with GNU Affero General Public License v3.0
from blockbasenetwork
public Task<IEnumerable<string>> Sign(string chainId, IEnumerable<string> requiredKeys, byte[] signBytes, IEnumerable<string> abiNames = null)
{
if (requiredKeys == null)
return Task.FromResult(new List<string>().AsEnumerable());
var availableAndReqKeys = requiredKeys.Intersect(Keys.Keys);
var data = new List<byte[]>()
{
Hex.HexToBytes(chainId),
signBytes,
new byte[32]
};
var hash = Sha256Manager.GetHash(SerializationHelper.Combine(data));
return Task.FromResult(availableAndReqKeys.Select(key =>
{
var sign = Secp256K1Manager.SignCompressedCompact(hash, Keys[key]);
var check = new List<byte[]>() { sign, KeyTypeBytes };
var checksum = Ripemd160Manager.GetHash(SerializationHelper.Combine(check)).Take(4).ToArray();
var signAndChecksum = new List<byte[]>() { sign, checksum };
return "SIG_K1_" + Base58.Encode(SerializationHelper.Combine(signAndChecksum));
}));
}
19
Source : UsedCertificateCache.cs
with MIT License
from BodnarSoft
with MIT License
from BodnarSoft
public string GetCachedValue(string databasePath)
{
var path = EncryptPath(databasePath);
if (Cache.TryGetValue(path, out var value))
{
if (value.IsValid)
{
var bytes = value.Data.AsEnumerable()
.ToArray();
ProtectedMemory.Unprotect(bytes, MemoryProtectionScope.SameProcess);
return Encoding.UTF8.GetString(bytes)
.Trim();
}
}
return null;
}
19
Source : TeeComposition.cs
with GNU Lesser General Public License v3.0
from bookfx
with GNU Lesser General Public License v3.0
from bookfx
public static Tee<T> FailFast<T>(params Tee<T>[] tees) => FailFast(tees.AsEnumerable());
19
Source : TeeComposition.cs
with GNU Lesser General Public License v3.0
from bookfx
with GNU Lesser General Public License v3.0
from bookfx
public static Tee<T> HarvestErrors<T>(params Tee<T>[] tees) =>
HarvestErrors(tees.AsEnumerable());
19
Source : ValidatorComposition.cs
with GNU Lesser General Public License v3.0
from bookfx
with GNU Lesser General Public License v3.0
from bookfx
public static Validator<T> FailFast<T>(params Validator<T>[] validators) => FailFast(validators.AsEnumerable());
19
Source : ValidatorComposition.cs
with GNU Lesser General Public License v3.0
from bookfx
with GNU Lesser General Public License v3.0
from bookfx
public static Validator<T> HarvestErrors<T>(params Validator<T>[] validators) =>
HarvestErrors(validators.AsEnumerable());
19
Source : Make.cs
with GNU Lesser General Public License v3.0
from bookfx
with GNU Lesser General Public License v3.0
from bookfx
[Pure]
public static Book Book(params Sheet[] sheets) => Book(sheets.AsEnumerable());
19
Source : Algoritm.cs
with GNU General Public License v3.0
from BoomTownROI
with GNU General Public License v3.0
from BoomTownROI
internal static string SortAndJoin(IEnumerable<string> words)
{
var joined = string.Join(" ", words.OrderBy(x => x).AsEnumerable());
return joined.Trim();
}
19
Source : Extensions.cs
with MIT License
from BotBuilderCommunity
with MIT License
from BotBuilderCommunity
public static string MakeList(params string[] elements)
{
return MakeList(elements.AsEnumerable());
}
19
Source : StringCollectionAssertions.cs
with Apache License 2.0
from BoundfoxStudios
with Apache License 2.0
from BoundfoxStudios
public new AndConstraint<StringCollectionreplacedertions> Equal(params string[] expected)
{
return base.Equal(expected.AsEnumerable());
}
19
Source : StringCollectionAssertions.cs
with Apache License 2.0
from BoundfoxStudios
with Apache License 2.0
from BoundfoxStudios
public AndConstraint<StringCollectionreplacedertions> ContainInOrder(params string[] expected)
{
return base.ContainInOrder(expected.AsEnumerable());
}
19
Source : ExpressionExtensions.cs
with Apache License 2.0
from BoundfoxStudios
with Apache License 2.0
from BoundfoxStudios
public static MemberPath GetMemberPath<TDeclaringType, TPropertyType>(
this Expression<Func<TDeclaringType, TPropertyType>> expression)
{
Guard.ThrowIfArgumentIsNull(expression, nameof(expression), "Expected an expression, but found <null>.");
var segments = new List<string>();
var declaringTypes = new List<Type>();
Expression node = expression;
var unsupportedExpressionMessage = $"Expression <{expression.Body}> cannot be used to select a member.";
while (node != null)
{
#pragma warning disable IDE0010 // System.Linq.Expressions.ExpressionType has many members we do not care about
switch (node.NodeType)
#pragma warning restore IDE0010
{
case ExpressionType.Lambda:
node = ((LambdaExpression)node).Body;
break;
case ExpressionType.Convert:
case ExpressionType.ConvertChecked:
var unaryExpression = (UnaryExpression)node;
node = unaryExpression.Operand;
break;
case ExpressionType.MemberAccess:
var memberExpression = (MemberExpression)node;
node = memberExpression.Expression;
segments.Add(memberExpression.Member.Name);
declaringTypes.Add(memberExpression.Member.DeclaringType);
break;
case ExpressionType.ArrayIndex:
var binaryExpression = (BinaryExpression)node;
var constantExpression = (ConstantExpression)binaryExpression.Right;
node = binaryExpression.Left;
segments.Add("[" + constantExpression.Value + "]");
break;
case ExpressionType.Parameter:
node = null;
break;
case ExpressionType.Call:
var methodCallExpression = (MethodCallExpression)node;
if (methodCallExpression.Method.Name != "get_Item" || methodCallExpression.Arguments.Count != 1 || !(methodCallExpression.Arguments[0] is ConstantExpression))
{
throw new ArgumentException(unsupportedExpressionMessage, nameof(expression));
}
constantExpression = (ConstantExpression)methodCallExpression.Arguments[0];
node = methodCallExpression.Object;
segments.Add("[" + constantExpression.Value + "]");
break;
default:
throw new ArgumentException(unsupportedExpressionMessage, nameof(expression));
}
}
// If any members were accessed in the expression, the first one found is the last member.
Type declaringType = declaringTypes.FirstOrDefault() ?? typeof(TDeclaringType);
string[] reversedSegments = segments.AsEnumerable().Reverse().ToArray();
string segmentPath = string.Join(".", reversedSegments);
return new MemberPath(declaringType, segmentPath.Replace(".[", "["));
}
19
Source : ColorMatcher.cs
with MIT License
from bozho
with MIT License
from bozho
public IEnumerable<IColorMatch<TTarget>> GetMatches() { return mMatches.AsEnumerable(); }
19
Source : ChatDisplay.cs
with MIT License
from brian91292
with MIT License
from brian91292
private IEnumerator UpdateMessagePositions()
{
while (!_applicationQuitting)
{
yield return _waitUntilMessagePositionsNeedUpdate;
yield return _waitForEndOfFrame;
float msgPos = ReverseChatOrder ? ChatHeight : 0;
foreach (var chatMsg in _messages.AsEnumerable().Reverse())
{
var msgHeight = (chatMsg.transform as RectTransform).sizeDelta.y;
if (ReverseChatOrder)
{
msgPos -= msgHeight;
}
chatMsg.transform.localPosition = new Vector3(0, msgPos);
if (!ReverseChatOrder)
{
msgPos += msgHeight;
}
}
_updateMessagePositions = false;
}
}
19
Source : MockJobManager.cs
with MIT License
from brminnick
with MIT License
from brminnick
public Task<IEnumerable<JobInfo>> GetJobs() => Task.FromResult(_jobDictionary.Values.AsEnumerable());
19
Source : MockNotificationManager.cs
with MIT License
from brminnick
with MIT License
from brminnick
public Task<IEnumerable<Notification>> GetPending() => Task.FromResult(_pendingNotificationsDitcionary.Values.AsEnumerable());
19
Source : DefaultServiceRouteFactory.cs
with MIT License
from brucehu123
with MIT License
from brucehu123
public Task<IEnumerable<ServiceRoute>> CreateServiceRoutesAsync(IEnumerable<ServiceRouteDescriptor> descriptors)
{
if (descriptors == null)
throw new ArgumentNullException(nameof(descriptors));
descriptors = descriptors.ToArray();
var routes = new List<ServiceRoute>(descriptors.Count());
routes.AddRange(descriptors.Select(descriptor => new ServiceRoute
{
Address = CreateAddress(descriptor.AddressDescriptors),
ServiceDescriptor = descriptor.ServiceDescriptor
}));
return Task.FromResult(routes.AsEnumerable());
}
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsIn<T>(this Expect<T> expect, IEnumerable<T> values, Issue<T>? issue = null) =>
expect.IsIn(values.AsEnumerable(), issue);
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsIn<T>(this Expect<T> expect, params T[] values) =>
expect.IsIn(values.AsEnumerable());
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsIn<T>(this Expect<T> expect, Issue<T> issue, params T[] values) =>
expect.IsIn(values.AsEnumerable(), issue);
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsIn<T>(this Expect<T> expect, IEqualityComparer<T> comparer, params T[] values) =>
expect.IsIn(values.AsEnumerable(), comparer);
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsIn<T>(this Expect<T> expect, IEqualityComparer<T> comparer, Issue<T> issue, params T[] values) =>
expect.IsIn(values.AsEnumerable(), comparer, issue);
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsNotIn<T>(this Expect<T> expect, IEnumerable<T> values, Issue<T>? issue = null) =>
expect.IsNotIn(values.AsEnumerable(), issue);
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsNotIn<T>(this Expect<T> expect, params T[] values) =>
expect.IsNotIn(values.AsEnumerable());
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsNotIn<T>(this Expect<T> expect, IEqualityComparer<T> comparer, params T[] values) =>
expect.IsNotIn(values.AsEnumerable(), comparer);
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsNotIn<T>(this Expect<T> expect, Issue<T> issue, params T[] values) =>
expect.IsNotIn(values.AsEnumerable(), issue);
19
Source : Expectable.cs
with MIT License
from bwatts
with MIT License
from bwatts
public static Expect<T> IsNotIn<T>(this Expect<T> expect, IEqualityComparer<T> comparer, Issue<T> issue, params T[] values) =>
expect.IsNotIn(values.AsEnumerable(), comparer, issue);
19
Source : BuildTimelineViewModel.cs
with MIT License
from C1rdec
with MIT License
from C1rdec
private void GroupBySKill()
{
var skillGroups = this._skills.GroupBy(s => s.Gems.Max(g => g.Level));
foreach (var group in skillGroups)
{
var timelineItem = new TimelineItemViewModel(group.Key);
var wikiItems = new List<WikiItemBaseViewModel>();
foreach (var entry in group.AsEnumerable())
{
wikiItems.AddRange(entry.Gems.Select(g => new GemViewModel(g)));
}
foreach (var item in this._items.Where(i => i.Level == group.Key))
{
wikiItems.Add(new UniqueItemViewModel(item, false));
}
timelineItem.DetailedView = new GroupItemViewModel(wikiItems);
this.Timeline.AddItem(timelineItem);
}
foreach (var uniqueItem in this._items)
{
if (skillGroups.Any(s => s.Key == uniqueItem.Level))
{
continue;
}
var timelineItem = new TimelineItemViewModel(uniqueItem.Level)
{
DetailedView = new UniqueItemViewModel(uniqueItem, false),
};
this.Timeline.AddItem(timelineItem);
}
}
19
Source : PlayerVipListTests.cs
with GNU General Public License v3.0
from caioavidal
with GNU General Public License v3.0
from caioavidal
[Fact]
public void LoadVipList_Empty_CallLoadedEvent()
{
var sut = PlayerTestDataBuilder.Build(hp: 100);
var called = false;
sut.Vip.OnLoadedVipList += (_, _) => { called = true; };
sut.Vip.LoadVipList(Array.Empty<(uint, string)>().AsEnumerable());
replacedert.Empty(sut.Vip.VipList);
replacedert.True(called);
}
19
Source : Generator.cs
with MIT License
from canton7
with MIT License
from canton7
private void GenerateType(Typereplacedysis typereplacedysis)
{
var outerTypes = new List<INamedTypeSymbol>();
for (var outerType = typereplacedysis.TypeSymbol.ContainingType; outerType != null; outerType = outerType.ContainingType)
{
outerTypes.Add(outerType);
}
foreach (var outerType in outerTypes.AsEnumerable().Reverse())
{
this.writer.WriteLine($"partial {outerType.ToDisplayString(SymbolDisplayFormats.TypeDeclaration)}");
this.writer.WriteLine("{");
this.writer.Indent++;
}
this.writer.Write($"partial {typereplacedysis.TypeSymbol.ToDisplayString(SymbolDisplayFormats.TypeDeclaration)}");
if (!typereplacedysis.HasInpcInterface)
{
this.writer.Write(" : global::System.ComponentModel.INotifyPropertyChanged");
}
this.writer.WriteLine();
this.writer.WriteLine("{");
this.writer.Indent++;
if (typereplacedysis.RequiresEvent)
{
string nullable = typereplacedysis.NullableContext.HasFlag(NullableContextOptions.Annotations) ? "?" : "";
this.writer.WriteLine($"public event global::System.ComponentModel.PropertyChangedEventHandler{nullable} PropertyChanged;");
}
foreach (var member in typereplacedysis.Members)
{
this.GenerateMember(typereplacedysis, member);
}
if (typereplacedysis.RequiresRaisePropertyChangedMethod)
{
Trace.replacedert(typereplacedysis.RaisePropertyChangedMethodSignature.NameType == RaisePropertyChangedNameType.PropertyChangedEventArgs &&
typereplacedysis.RaisePropertyChangedMethodSignature.HasOldAndNew == false);
this.writer.WriteLine($"protected virtual void {typereplacedysis.RaisePropertyChangedMethodName}(global::System.ComponentModel.PropertyChangedEventArgs eventArgs)");
this.writer.WriteLine("{");
this.writer.Indent++;
this.writer.WriteLine("this.PropertyChanged?.Invoke(this, eventArgs);");
this.writer.Indent--;
this.writer.WriteLine("}");
}
this.writer.Indent--;
this.writer.WriteLine("}");
for (int i = 0; i < outerTypes.Count; i++)
{
this.writer.Indent--;
this.writer.WriteLine("}");
}
}
19
Source : TestsBase.cs
with MIT License
from canton7
with MIT License
from canton7
public Expectation HasFile(string name, string source, params CSharpSyntaxVisitor<SyntaxNode?>[] rewriters) =>
this.HasFile(name, source, rewriters.AsEnumerable());
19
Source : OptionStrategyMatcherOptions.cs
with Apache License 2.0
from Capnode
with Apache License 2.0
from Capnode
public static OptionStrategyMatcherOptions ForDefinitions(params OptionStrategyDefinition[] definitions)
{
return ForDefinitions(definitions.AsEnumerable());
}
19
Source : ByteHelpers.cs
with GNU General Public License v3.0
from chaincase-app
with GNU General Public License v3.0
from chaincase-app
public static byte[] Combine(params byte[][] arrays)
{
return Combine(arrays.AsEnumerable());
}
19
Source : PatchChangeFriendship.cs
with GNU General Public License v3.0
from ChroniclerCherry
with GNU General Public License v3.0
from ChroniclerCherry
internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> instructionList = instructions.ToList();
for (int i = 0; i < instructionList.Count; i++)
{
if (instructionList[i].opcode == OpCodes.Ldc_I4)
{
if (instructionList[i].operand.ToString() == "2000")
{
//change the cap from 8 hearts to 10 when increasing friendship
instructionList[i].operand = 2500;
}
else if (instructionList[i].operand.ToString() == "2498")
{
//changes the hard cap for non-dating from 2498 to 10 hearts
instructionList[i].operand = 2500;
break;
}
}
}
return instructionList.AsEnumerable();
}
See More Examples