RiSE4fun samples for SealList of built-in samples for the Seal in RiSE4funen-USrise4fun &copy; 2017 Microsoft Corporationhttp://rise4fun.com//Images/Rise.gifRiSE4fun samples for Sealhttp://rise4fun.com/Seal/PureMethodPureMethodusing System; class Test { public Test f = null; public void PureMethod(Test param){ var temp = new Test(); temp.f = param; } } http://rise4fun.com/Seal/ImpureMethodImpureMethodusing System; class Test { public Test f = null; public void ImpureMethod(Test param){ var temp = new Test(); param.f = temp; } } http://rise4fun.com/Seal/ConditionallyPureConditionallyPureusing System; class Test { //Object::Equals() method is a call-back which can potentially do anything public bool ConditionallyPureMethod(Object param){ var temp = new Test(); return param.Equals(temp); } } http://rise4fun.com/Seal/TestParameterUpdateTestParameterUpdateusing System; class Test { private int f = 0; public void C(Test inst3){ A(new Test()); var temp = inst3.foo(); temp.f = 3; } public void A(Test inst){ inst.f = 1; } public Test foo(){ return this; } } http://rise4fun.com/Seal/TestAliasingRuleTestAliasingRuleusing System; class TestAliasing { TestAliasing f = null; public void A() { TestAliasing inst2 = new TestAliasing(); var local = B(inst2, inst2, this); local.f = new TestAliasing(); } public TestAliasing B(TestAliasing p1, TestAliasing p2, TestAliasing p3) { p2.f = p3; return p1.f; } } http://rise4fun.com/Seal/LinqtestLinqtestusing System; using System.Collections.Generic; using System.Linq; public class LinqTest { int f; public void foo(LinqTest param){ var col = from i in IntegerGenerator(param) select i; foreach (var y in col) { y.f = 1; } } private IEnumerable<LinqTest> IntegerGenerator(LinqTest r) { yield return r; } } http://rise4fun.com/Seal/TestHeapCloningTestHeapCloningusing System; public class TestHeapCloning{ TestHeapCloning f; int h; public void foo(TestHeapCloning param){ TestHeapCloning local1 = bar(); TestHeapCloning local2 = bar(); local1.f = param; local2.f = new TestHeapCloning(); local2.f.h = 1; } public TestHeapCloning bar(){ TestHeapCloning r = new TestHeapCloning(); return r; } } http://rise4fun.com/Seal/TestInstanceDelegatesTestInstanceDelegatesusing System; class TestInstanceDelegates{ TestInstanceDelegates f = null; void foo(System.Func<TestInstanceDelegates, int> del){ del(this); } public void start(TestInstanceDelegates testDel1, TestInstanceDelegates testDel2){ testDel1.foo((TestInstanceDelegates param) => { testDel2.f = new TestInstanceDelegates(); param.f = testDel2.f; return 0; }); } } http://rise4fun.com/Seal/TestExceptionsTestExceptionsusing System; public class TestExceptions{ public int f = 0; public void foo(int a){ try { bar(); } catch (MyException e){ e.te.f = -1; throw e; } } public void bar(){ throw new MyException(this); } } public class MyException : Exception { public TestExceptions te; public MyException(TestExceptions testExcep) { te = testExcep; } } http://rise4fun.com/Seal/TestCollectionsTestCollectionsusing System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TestMscorlibCalls { public class TestMscorlibCalls { String f = "Hello"; public void foo(List<String> paramList) { List<TestMscorlibCalls> l = new List<TestMscorlibCalls>(); l.Add(this); foreach (var elem in l) { elem.f = "Hi"; } } public void bar(List<String> paramSet) { Dictionary<TestMscorlibCalls, String> d = new Dictionary<TestMscorlibCalls, string>(); d.Add(this, this.f); foreach (var key in d.Keys) { key.f = "Hi"; } } } }