.net - Can we have Class.Empty Object like we have in String.Empty -
I am using .NET 3.5. I am making a simple class and want to make sure that the orbital class after processing should not be meaningless or should not be new.
So if we can test it the same way
Do some processing with the class 'objClass ()' and then .. Check that If this object is not empty, then 'if (objClass = Class.Empty) then // what other stuff is / what other content termination
is there any way we can do this empty area As we are in the string. Empty?
But in your example the class is not technically empty You can use a default constructor Who has made the example, who knows, the default constructor can start with 10 MB string content.
For example, see examples of VB constructor and what is happening.
Compare if you have implemented correctly (...) You can call
if (objClass.CompareTo (new category ()) == 0) So // What is the content other i.e. the other content ends if but it appears to be overwhelming / expensive, but the only way it will work.
Another option would be: (sorry C # based example)
interface IEmpyClass {bool ISEmptyClass {get;}} Public class class: IEmptyClass {public bool ISEmptyClass {get ; Private set;} Public class () {IsEmptyClass = true; } Public Zero DoSomething () {// do something IsEmptyClass = false; }}
You will be responsible for implementing the example and changing the property when the class state will be replaced with "empty", but this code can be faster in the code etc. If there is a constructor with the members, it can be tested only with
if (objClass.IsEmptyClass) // If the other content is // Other content end if
Comments
Post a Comment