static void Main(string[] args) { SomeThing st = new SomeThing { Alpha = "x.a", Beta = "x.b", ThisThing = new Thing { Alpha = "y.a", Beta = "y.b" }, ThatThing = new SomeThingElse { Alpha = "z.a", Beta = "z.b", Delta = 42, Epsilon = new Thing { Alpha = "e.a", Beta = "e.b" } } }; JsonSerializerSettings settings = new JsonSerializerSettings(); settings.ContractResolver = new MyContractResolver(); settings.Formatting = Formatting.Indented; string json = JsonConvert.SerializeObject(st, settings); Console.WriteLine(json); }
private void Button1_Click(object sender, System.EventArgs e) { SomeThing t1 = new SomeThing("Thing 1"); SomeThing t2 = new SomeThing("Thing 2"); ArrayList list = new ArrayList(); list.Add(t1); list.Add(t2); Repeater3.DataSource = list; Repeater3.DataBind(); }
public void Scenario(SomeThing subjectId, Action action) { "Given a subject identifier" .f(() => subjectId = new SomeThing { Value = "subjectId" }); "When a subject is created with that identifier" .f(() => action = () => new Subject(subjectId)); "Then that actions should throw an exception" .f(() => action.ShouldThrow <RuntimeException>()); }
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { SomeThing st = (SomeThing)value; JObject obj = new JObject(); obj.Add("alpha", st.Alpha); obj.Add("beta", st.Beta); JObject things = new JObject(); things.Add("thisThing", JToken.FromObject(st.ThisThing, serializer)); things.Add("thatThing", JToken.FromObject(st.ThatThing, serializer)); obj.Add("things", things); obj.WriteTo(writer); }
private void Page_Load(object sender, System.EventArgs e) { ArrayList list1 = new ArrayList(); SomeThing thing1 = new SomeThing("Hello"); thing1.InnerList.Add("Hello"); thing1.InnerList.Add("World"); SomeThing thing2 = new SomeThing("World"); thing2.InnerList.Add("blah"); thing2.InnerList.Add("blah"); thing2.InnerList.Add("blah"); thing2.InnerList.Add("blah"); list1.Add(thing1); list1.Add(thing2); ArrayList list2 = new ArrayList(); list2.Add("wtf?"); Repeater1.DataSource = list1; Repeater2.DataSource = list2; Repeater1.DataBind(); Repeater2.DataBind(); ArrayList fiveThings = new ArrayList(); fiveThings.Add(new SomeThing("one")); fiveThings.Add(new SomeThing("two")); fiveThings.Add(new SomeThing("three")); fiveThings.Add(new SomeThing("four")); fiveThings.Add(new SomeThing("five")); headerRepeater.DataSource = fiveThings; headerRepeater.DataBind(); separatorRepeater.DataSource = fiveThings; separatorRepeater.DataBind(); footerRepeater.DataSource = fiveThings; footerRepeater.DataBind(); alternatingRepeater.DataSource = fiveThings; alternatingRepeater.DataBind(); allRepeater.DataSource = fiveThings; allRepeater.DataBind(); }
public void DynamicBaseClassSomeThingTest() { PersonDynamic person = new PersonDynamic() { ReferenceName = "person", Name = "ALLEN" }; SomeThing thing = new SomeThing() { }; Rule rule = new Rule("TestM(person[Name]) = 'allen'"); RuleValidator ruleValidator = new RuleValidator(); var result = ruleValidator.ValidateExpressionRulesAll( new DynamicBaseClass[] { person, thing }, new Rule[] { rule }); Assert.AreEqual(result, true); }
static void Main(string[] args) { SomeThing st = new SomeThing { Alpha = "x.a", Beta = "x.b", ThisThing = new Thing { Alpha = "y.a", Beta = "y.b" }, ThatThing = new Thing { Alpha = "z.a", Beta = "z.b" } }; JsonSerializerSettings settings = new JsonSerializerSettings(); settings.Converters.Add(new SomeThingConverter()); settings.Formatting = Formatting.Indented; string json = JsonConvert.SerializeObject(st, settings); Console.WriteLine(json); }
static void Main(string[] args) { using SomeThing thing = new SomeThing(); }
private void Handle(NewSubject @event) { this.SomeThing = Map.Event(@event).ToEntity <SomeThing>(); }
public Subject(SomeThing someThing) { this.Apply(Map.Entity(someThing).ToEvent <NewSubject>()); }
public void Emit() { SomeThing?.Invoke(this, 1); }