当前位置: 首页>>代码示例>>C#>>正文


C# Sample类代码示例

本文整理汇总了C#中Sample的典型用法代码示例。如果您正苦于以下问题:C# Sample类的具体用法?C# Sample怎么用?C# Sample使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Sample类属于命名空间,在下文中一共展示了Sample类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的Sample类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。