Example #1
0
        private string ObjectInsideObject()
        {
            sampleObj = new SampleObj();
            return(sampleObj.ChildObj.Item2);

            //fix
            return(sampleObj.ChildObj?.Item2);
            //or instantiate the child object in the main object constructor
        }
Example #2
0
        public ErrorSamples(SampleObj sampleInjectedObj)
        {
            this.sampleinjectedObj = sampleInjectedObj;


            var nullObject = new SampleObj();

            if (nullObject != null)
            {
                //does something
                var item = nullObject.Item1;
            }
        }