本文整理汇总了C#中Sample类的典型用法代码示例。如果您正苦于以下问题:C# Sample类的具体用法?C# Sample怎么用?C# Sample使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sample类属于命名空间,在下文中一共展示了Sample类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SecureRandom
/**
* Create a System.Random object from this RandomNumberGenerator
*/
public SecureRandom(RandomNumberGenerator rng) {
_rng = rng;
_sample_buffer = new byte[4];
_state = new Sample();
_state.Val = 0;
_state.Max = 1;
}
开发者ID:johnynek,项目名称:brunet,代码行数:10,代码来源:SecureRandom.cs
示例2: samplesTreeView_AfterSelect
private void samplesTreeView_AfterSelect(object sender, TreeViewEventArgs e)
{
TreeNode currentNode = samplesTreeView.SelectedNode;
currentSample = (Sample)currentNode.Tag;
if (currentSample != null)
{
currentHarness = currentSample.Harness;
runButton.Enabled = true;
descriptionTextBox.Text = currentSample.Description;
codeRichTextBox.Clear();
codeRichTextBox.Text = currentSample.Code;
colorizeCode(codeRichTextBox);
outputTextBox.Clear();
}
else
{
currentHarness = null;
runButton.Enabled = false;
descriptionTextBox.Text = "Select a query from the tree to the left.";
codeRichTextBox.Clear();
outputTextBox.Clear();
if (e.Action != TreeViewAction.Collapse && e.Action != TreeViewAction.Unknown)
e.Node.Expand();
}
}
开发者ID:AlehSkamarokhau,项目名称:PrototypeApps,代码行数:25,代码来源:SampleForm.cs
示例3: Test01
void Test01()
{
var gd = new Connect();
var sample = new Sample
{
Method = "GET",
Uri = "/test",
Timestamp = DateTime.Now.TimeOfDay.TotalMilliseconds,
ResponseTime = 100,
CpuTime = 20,
Context =
new[]
{
new Context {Name = "/", ResponseTime = 11},
new Context {Name = "/one", ResponseTime = 12},
new Context {Name = "/two", ResponseTime = 13}
}
};
gd.Init("26873", "testing", logger, null);
for (int i = 0; i < 1000; i++)
{
gd.Store(sample, logger, null);
Thread.Sleep(300);
}
gd.Term(logger, null);
Console.Read();
}
开发者ID:alphashack,项目名称:NET_graphdat,代码行数:27,代码来源:Program.cs
示例4: CanGetUsingTestProperty
public void CanGetUsingTestProperty()
{
var obj = new Sample { TestProp = 42 };
var prop = typeof(Sample).GetProperty("TestProp").ToSettable();
prop.Get(obj).Should().Be(42);
}
开发者ID:marcosli,项目名称:simpledotnet,代码行数:7,代码来源:SettableMemberFixture.cs
示例5: AnovaDistribution
public void AnovaDistribution()
{
Distribution sDistribution = new NormalDistribution();
Random rng = new Random(1);
Sample fSample = new Sample();
// do 100 ANOVAs
for (int t = 0; t < 100; t++) {
// each ANOVA has 4 groups
List<Sample> groups = new List<Sample>();
for (int g = 0; g < 4; g++) {
// each group has 3 data points
Sample group = new Sample();
for (int i = 0; i < 3; i++) {
group.Add(sDistribution.GetRandomValue(rng));
}
groups.Add(group);
}
OneWayAnovaResult result = Sample.OneWayAnovaTest(groups);
fSample.Add(result.Factor.Result.Statistic);
}
// compare the distribution of F statistics to the expected distribution
Distribution fDistribution = new FisherDistribution(3, 8);
Console.WriteLine("m={0} s={1}", fSample.PopulationMean, fSample.PopulationStandardDeviation);
TestResult kResult = fSample.KolmogorovSmirnovTest(fDistribution);
Console.WriteLine(kResult.LeftProbability);
Assert.IsTrue(kResult.LeftProbability < 0.95);
}
开发者ID:JackDetrick,项目名称:metanumerics,代码行数:32,代码来源:SampleTest.cs
示例6: Main
static void Main(string[] args)
{
Class2 instance = new Class2();
Sample sample = new Sample(instance.method);
int result = sample(2 , 3);
Console.WriteLine(result);
}
开发者ID:basyura,项目名称:cs_sample,代码行数:7,代码来源:sample025.cs
示例7: ToStringTest
public void ToStringTest()
{
var sample = new Sample(Title, SampleCategory.Game, "Game.sln", "Game.csproj", "Game.exe");
Assert.AreEqual(
"Sample: Title=" + Title + ", Category=" + Category + ", Description=" + Description,
sample.ToString());
}
开发者ID:remy22,项目名称:DeltaEngine,代码行数:7,代码来源:SampleTests.cs
示例8: GetSample
public Sample GetSample(Sample prevSample)
{
Sample sm;
if (!lowLatency || (pass >= MagicValue2))
{
previewOver = true;
// In order to improve ray coherency
if (samplePerPixel == 1)
sm = GetNextSample1x1(prevSample);
else
sm = GetNextSampleNxN(prevSample);
}
else if (previewOver || (pass >= MagicValue1))
{
previewOver = true;
sm = GetNextSampleNxN(prevSample);
}
else
{
// In order to update the screen faster for the first 16 passes
sm = GetNextSamplePreview();
}
TotalSamples++;
//sm.imageY += screenStartLine;
return sm;
}
开发者ID:HungryBear,项目名称:rayden,代码行数:26,代码来源:RandomSampler.cs
示例9: Main
static void Main(string[] args)
{
var s = new Sample();
s.PropertyChanged += (_, e) =>
{
switch (e.PropertyName)
{
case "X":
Console.WriteLine($"X = {s.X}");
break;
case "Y":
Console.WriteLine($"Y = {s.Y}");
break;
}
};
s.X = 10;
s.Y = 20;
/*
結果:
X = 10
Y = 20
*/
}
开发者ID:ufcpp,项目名称:UfcppSample,代码行数:27,代码来源:Program.cs
示例10: TutorialTitlesAreSplitAndAllOtherCategoriesAreNotSplit
public void TutorialTitlesAreSplitAndAllOtherCategoriesAreNotSplit()
{
var game = new Sample("DoNotSplit", SampleCategory.Game, "A.sln", "B.csproj", "C.exe");
var tutorial = new Sample("SplitThis", SampleCategory.Tutorial, "A.sln", "B.csproj", "C.exe");
Assert.AreEqual("DoNotSplit", game.Title);
Assert.AreEqual("Split This", tutorial.Title);
}
开发者ID:whztt07,项目名称:DeltaEngine,代码行数:7,代码来源:SampleTests.cs
示例11: CheckThatGetAttributeFromReturnsCorrectValues
public void CheckThatGetAttributeFromReturnsCorrectValues()
{
Sample s = new Sample();
Assert.NotNull(s.GetAttributeFrom<RequiredAttribute>(nameof(s.IntProperty)));
Assert.Null(s.GetAttributeFrom<StringLengthAttribute>(nameof(s.IntProperty)));
Assert.NotNull(s.GetAttributeFrom<StringLengthAttribute>(nameof(s.StringProperty)));
}
开发者ID:Insvald,项目名称:Taygeta,代码行数:7,代码来源:RetrieveExtensionTest.cs
示例12: ShouldReturnSameInstanceAfterCreatingDefaultValue
public void ShouldReturnSameInstanceAfterCreatingDefaultValue()
{
var stub = new Sample();
var value1 = stub.Child;
var value2 = stub.Child;
value1.ShouldBe(value2);
}
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:7,代码来源:NotifyPropertyChangedBase.Test.silverlight.cs
示例13: ProcedureIsExecuted
public void ProcedureIsExecuted()
{
cellProcessor.Get<Procedures>().Save("procedure", new CellTree(new CellTree("define", "procedure"), new CellTree("settext")));
var sample = new Sample();
invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree());
Assert.AreEqual("hi", sample.Text);
}
开发者ID:ChrisBDFA,项目名称:fitsharp,代码行数:7,代码来源:InvokeProcedureTest.cs
示例14: ParameterValueIsSubstituted
public void ParameterValueIsSubstituted()
{
cellProcessor.Get<Procedures>().Save("procedure", new CellTree(new CellTree("define", "procedure", "parm"), new CellTree("settext", "parm")));
var sample = new Sample();
invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree("actual"));
Assert.AreEqual("actual", sample.Text);
}
开发者ID:ChrisBDFA,项目名称:fitsharp,代码行数:7,代码来源:InvokeProcedureTest.cs
示例15: KendallNullDistributionTest
public void KendallNullDistributionTest()
{
// pick independent distributions for x and y, which needn't be normal and needn't be related
Distribution xDistrubtion = new LogisticDistribution();
Distribution yDistribution = new ExponentialDistribution();
Random rng = new Random(314159265);
// generate bivariate samples of various sizes
//int n = 64; {
foreach (int n in TestUtilities.GenerateIntegerValues(4, 64, 8)) {
Sample testStatistics = new Sample();
Distribution testDistribution = null;
for (int i = 0; i < 128; i++) {
BivariateSample sample = new BivariateSample();
for (int j = 0; j < n; j++) {
sample.Add(xDistrubtion.GetRandomValue(rng), yDistribution.GetRandomValue(rng));
}
TestResult result = sample.KendallTauTest();
testStatistics.Add(result.Statistic);
testDistribution = result.Distribution;
}
//TestResult r2 = testStatistics.KolmogorovSmirnovTest(testDistribution);
//Console.WriteLine("n={0} P={1}", n, r2.LeftProbability);
//Assert.IsTrue(r2.RightProbability > 0.05);
Console.WriteLine("{0} {1}", testStatistics.PopulationVariance, testDistribution.Variance);
Assert.IsTrue(testStatistics.PopulationMean.ConfidenceInterval(0.95).ClosedContains(testDistribution.Mean));
Assert.IsTrue(testStatistics.PopulationVariance.ConfidenceInterval(0.95).ClosedContains(testDistribution.Variance));
}
}
开发者ID:JackDetrick,项目名称:metanumerics,代码行数:35,代码来源:NullDistributionTests.cs
示例16: ClientInstruments
public ClientInstruments()
{
Samples = new List<float[]>();
States = new List<bool>();
var r = new Random();
for (int i = 0; i < 16; i++)
{
States.Add(false);
float vol = (float)r.NextDouble();
float freq = (float)r.Next(500)+100.0f;
var s = new Sample(0.25f, 8000);
for (int j = 0; j < s.Count; j++)
{
s[j].Volume = vol;
s[j].Frequency = freq;
}
var transform = r.Next(4);
if (transform == 0)
Samples.Add(Transforms.GenerateSawtoothWaveform(s));
if (transform == 1)
Samples.Add(Transforms.GenerateSineWaveform(s));
if (transform == 2)
Samples.Add(Transforms.GenerateSquareWaveform(s));
if (transform == 3)
Samples.Add(Transforms.GenerateTriangleWaveform(s));
}
}
开发者ID:longjoel,项目名称:master,代码行数:33,代码来源:Program.cs
示例17: CookieJar_Example1
public void CookieJar_Example1(int total, int choc1, int choc2, int expectedNumerator, int expectedDenominator)
{
var sample1 = new Sample<Cookie>("Jar1");
var sample2 = new Sample<Cookie>("Jar2");
var hypos = new HypoSet<Cookie>("All");
hypos.Add(sample1, sample2);
sample1.Add(total - choc1, n => new Cookie() { F = 'V' });
sample1.Add(choc1, n => new Cookie() { F = 'C' });
sample2.Add(total - choc2, n => new Cookie() { F = 'V' });
sample2.Add(choc2, n => new Cookie() { F = 'C' });
var choc = It.IsAny<Cookie>(c => c.F == 'C');
var vani = It.IsAny<Cookie>(c => c.F == 'V');
sample1.ProbabilityOfEvent(choc);
sample2.ProbabilityOfEvent(choc);
var postProb = hypos.PosterierProbability(sample1, vani);
Assert.That(postProb.Numerator, Is.EqualTo(expectedNumerator));
Assert.That(postProb.Denominator, Is.EqualTo(expectedDenominator));
}
开发者ID:roberino,项目名称:linqinfer,代码行数:25,代码来源:HypoSetTests.cs
示例18: ProcedureExecutionIsLogged
public void ProcedureExecutionIsLogged()
{
cellProcessor.Get<Procedures>().Save("procedure", Parse.ParseFrom(noParameterProcedureHtml));
var sample = new Sample();
invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree());
Assert.AreEqual("<br><table border=1><tr><td>settext</td></tr></table>", cellProcessor.TestStatus.LastAction);
}
开发者ID:DioF,项目名称:fitsharp,代码行数:7,代码来源:InvokeProcedureTest.cs
示例19: Serialize
public void Serialize(string filename, Sample[] samples)
{
var sampleBrowser = new SampleBrowser {Samples = samples};
using (var stream = new FileStream(filename, FileMode.Create))
_serializer.Serialize(stream, sampleBrowser);
}
开发者ID:andyhebear,项目名称:mogresdk,代码行数:7,代码来源:ConfigurationSerializer.cs
示例20: ProcedureIsExecutedOnACopyOfBody
public void ProcedureIsExecutedOnACopyOfBody()
{
cellProcessor.Get<Procedures>().Save("procedure", Parse.ParseFrom(errorProcedureHtml));
var sample = new Sample();
invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree());
Assert.AreEqual(errorProcedureHtml, cellProcessor.Get<Procedures>().GetValue("procedure").ToString());
}
开发者ID:DioF,项目名称:fitsharp,代码行数:7,代码来源:InvokeProcedureTest.cs
注:本文中的Sample类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论