There is no such thing as property overloading in C#. What you are asking about is called an indexer. Here is an example of an indexer:
public class Foo
{
SomeObject this[int index]
{
// The get accessor.
get
{
// return the value specified by index
}
// The set accessor.
set
{
// set the value specified by index
}
}
}
That means I can treat Foo
like an array as follows:
var f1 = new Foo();
SomeObject someObj = f1[1];
In your case the documentation has this:
public Room this[
Phase phase
] { get; }
What that means is that FamilyInstance
has an indexer which takes a Phase
instance and returns a Room
. So you would use it like this:
// If phase is abstract then new the concrete type. I am not familiar with revit API
var somePhase = new Phase();
famInst[somePhase];
Or, since it is a named indexer, you can do this:
famInst.FromRoom[somePhase];
The other one is a plain property and documented like this:
public Room FromRoom { get; }
You can only access that property but you cannot set it like this:
Room room = famInst.FromRoom;
So basically, and indexer allows you to treat a class like an array even though the class is not an array. In this case FamilyInstance
can be treated like an array. There are many types in .NET which have indexers, for example, String
has an indexer like this:
public char this[int index] { get; }
It takes an it and returns a char
at that index or it throws an exception if the index is outside the range.