Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code format #1065

Merged
merged 4 commits into from Jul 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -4,39 +4,40 @@

public class Example
{
public static void Main()
{
Assembly assem = typeof(Example).Assembly;
Type t = assem.GetType("Transportation.MeansOfTransportation");
if (t != null) {
Console.WriteLine("Virtual properties in type {0}:",
t.FullName);
PropertyInfo[] props = t.GetProperties();
int nVirtual = 0;
for (int ctr = 0; ctr < props.Length; ctr++)
if (props[ctr].GetMethod.IsVirtual) {
Console.WriteLine(" {0} (type {1})",
props[ctr].Name,
props[ctr].PropertyType.FullName);
nVirtual++;
public static void Main()
{
Assembly assem = typeof(Example).Assembly;
Type t = assem.GetType("Transportation.MeansOfTransportation");
if (t != null)
{
Console.WriteLine($"Virtual properties in type {t.FullName}:");
PropertyInfo[] props = t.GetProperties();
int nVirtual = 0;
for (int ctr = 0; ctr < props.Length; ctr++)
{
if (props[ctr].GetMethod.IsVirtual)
{
Console.WriteLine($" {props[ctr].Name} (type {props[ctr].PropertyType.FullName})");
nVirtual++;
}
}

if (nVirtual == 0)
Console.WriteLine(" No virtual properties");
}
}
if (nVirtual == 0)
Console.WriteLine(" No virtual properties");
}
}
}

namespace Transportation
{
public abstract class MeansOfTransportation
{
abstract public bool HasWheels { get; set; }
abstract public int Wheels { get; set; }
abstract public bool ConsumesFuel { get; set; }
abstract public bool Living { get; set; }
}
public abstract class MeansOfTransportation
{
abstract public bool HasWheels { get; set; }
abstract public int Wheels { get; set; }
abstract public bool ConsumesFuel { get; set; }
abstract public bool Living { get; set; }
}

}
// The example displays the following output:
// Virtual properties in type Transportation.MeansOfTransportation:
Expand Down