This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
namespace VectorSearch.Memory; | |
public readonly ref struct MemoryRef<T> | |
{ | |
private readonly ref T _value; | |
public MemoryRef(ref T value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a webservice | |
public class MyWebService : Service | |
{ | |
private IMyService _myService; | |
public MyWebService(IMyService myService) | |
{ | |
_myService = myService; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ref struct ParsedString | |
{ | |
private readonly ReadOnlySpan<byte> _valueSpan; | |
private readonly Encoding _encoding; | |
private readonly string _value; | |
public bool IsDeferred { get; } | |
/// <summary> | |
/// Deferred reading ctor. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ObservableCollectionView<T> : IReadOnlyCollection<T>, INotifyCollectionChanged, IDisposable | |
{ | |
private readonly ObservableCollection<T> _sourceCollection; | |
private List<T> _localCollection = new List<T>(); | |
public int Count => _localCollection.Count; | |
public event NotifyCollectionChangedEventHandler CollectionChanged; | |
public bool IsOrdered => OrderComparer != null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IEntitySelectQueryBuilder<TEntity> AndWhere<TEntity>(this IEntitySelectQueryBuilder<TEntity> builder, ISchemaField<TEntity> schemaField, ComparisonOperator @operator, TEntity entity) | |
where TEntity : class => builder.AndWhere<IEntitySelectQueryBuilder<TEntity>, TEntity>(schemaField, @operator, entity); | |
public static IEntitySelectQueryBuilder<TEntity> AndWhere<TEntity, TValue>(this IEntitySelectQueryBuilder<TEntity> builder, ISchemaField<TEntity> schemaField, ComparisonOperator @operator, TValue value) | |
where TEntity : class => builder.AndWhere<IEntitySelectQueryBuilder<TEntity>, TEntity, TValue>(schemaField, @operator, value); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class BigEndianBitConverter | |
{ | |
public static UInt16 ToUInt16(byte[] value, int startIndex) | |
{ | |
return (ushort)( | |
value[startIndex + 1] | | |
value[startIndex] << 8 | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static UInt16 ToUInt16(byte[] value, int startIndex) | |
{ | |
return (ushort)( | |
value[startIndex + 1] + | |
(value[startIndex] * 256) | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Author: John Carruthers ([email protected]) | |
// | |
// Copyright (C) 2014 John Carruthers | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining | |
// a copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, | |
// distribute, sublicense, and/or sell copies of the Software, and to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Tests that the ManifestReader isn't loading assemblies. | |
/// </summary> | |
[TestMethod] | |
public void ManifestReaderDoesntLoadAssemblies() | |
{ | |
var didFail = false; | |
AppDomain.CurrentDomain.AssemblyLoad += (sender, args) => | |
{ | |
if (args.LoadedAssembly.FullName.IndexOf("SimplePlugin") != -1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Author: John Carruthers ([email protected]) | |
// | |
// Copyright (C) 2014 John Carruthers | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining | |
// a copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, | |
// distribute, sublicense, and/or sell copies of the Software, and to |
NewerOlder