本文整理汇总了C#中HashSet.AsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# HashSet.AsQueryable方法的具体用法?C# HashSet.AsQueryable怎么用?C# HashSet.AsQueryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HashSet
的用法示例。
在下文中一共展示了HashSet.AsQueryable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAlerts
// GET: api/Alerts
public IQueryable<AlertModel> GetAlerts()
{
HashSet<AlertModel> alerts = new HashSet<AlertModel>
{
new AlertModel
{
CreatedAt = DateTime.Now.AddMinutes(-3),
DigitalOutput = 1,
OutputText = "Camera1"
},
new AlertModel
{
CreatedAt = DateTime.Now.AddMinutes(-2),
DigitalOutput = 2,
OutputText = "Camera2"
},
new AlertModel
{
CreatedAt = DateTime.Now.AddMinutes(-1),
DigitalOutput = 3,
OutputText = "Camera3"
},
new AlertModel
{
CreatedAt = DateTime.Now,
DigitalOutput = 4,
OutputText = "Camera4"
}
};
return alerts.AsQueryable();
}
示例2: GetAll
public HttpResponseMessage GetAll()
{
var httpResponse = this.PerformOperation(() =>
{
var schoolEntities = this.unitOfWork.SchoolsRepository.GetAll().ToList();
var schoolModels = new HashSet<SchoolModel>();
foreach (var schoolEntity in schoolEntities)
{
schoolModels.Add(SchoolsMapper.ToSchoolModel(schoolEntity));
}
return schoolModels.AsQueryable<SchoolModel>();
});
return httpResponse;
}
示例3: Get
public HttpResponseMessage Get(string subject, double value)
{
var httpResponse = this.PerformOperation(() =>
{
var studentEntities = this.unitOfWork.StudentsRepository
.GetBySubjectAndMark(subject, value).ToList();
var studentModels = new HashSet<StudentModel>();
foreach (var studentEntity in studentEntities)
{
studentModels.Add(StudentsMapper.ToStudentModel(studentEntity));
}
return studentModels.AsQueryable<StudentModel>();
});
return httpResponse;
}
示例4: GetAssemblyFilesToReference
protected virtual IQueryable<string> GetAssemblyFilesToReference(ISitecoreConnectionSettings settings)
{
var list = new List<Assembly>
{
Assembly.Load(new AssemblyName("Sitecore.ContentSearch")),
Assembly.Load(new AssemblyName("Sitecore.ContentSearch.Linq")),
typeof(IQueryable).Assembly
};
var selectedType = settings.SearchResultType.GetSelectedType();
if (selectedType != null)
{
list.Add(selectedType.Assembly);
}
var assemblies = new HashSet<Assembly>();
foreach (var assembly in list)
{
this.AddAssemblyFiles(assembly, assemblies);
}
return (from a in assemblies.AsQueryable<Assembly>() select a.Location);
}
示例5: Get
public IQueryable<StudentsModel> Get(string subject, double value)
{
var httpResponse = this.PerformOperationAndHandleExceptions(() =>
{
var studentEntities = this
.GetBySubjectAndMark(subject, value).ToList();
var studentModels = new HashSet<StudentsModel>();
foreach (var studentEntity in studentEntities)
{
studentModels.Add(
new StudentsModel()
{
FirstName = studentEntity.FirstName,
LastName = studentEntity.LastName,
Age = studentEntity.Age,
Grade = studentEntity.Grade
});
}
return studentModels.AsQueryable<StudentsModel>();
});
return httpResponse;
}