using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace Zadatak { class Program { static void Main(string[] args) { Type type = Type.GetType("System.String"); Console.WriteLine(type.Name); Console.WriteLine(type.Namespace); Console.WriteLine(type.Assembly); Console.WriteLine(type.BaseType); Console.WriteLine(type.IsAbstract); Console.WriteLine(type.IsGenericTypeDefinition); Console.WriteLine(type.IsSealed); Console.WriteLine(type.IsClass); Console.WriteLine(); // Drugi deo zadatka Assembly assembly = null; try { assembly = Assembly.Load("Zadatak"); } catch (FileNotFoundException exc) { Console.WriteLine(exc.Message); } if (assembly == null) return; Type countryType = assembly.GetType("Zadatak.Country"); object countryObject = Activator.CreateInstance(countryType, new object[] { "Scotland", 4500000 }); MethodInfo methInfo = countryType.GetMethod("GetCountryInfo"); Console.WriteLine(methInfo.Invoke(countryObject, null)); } } class Country { public string Name { get; set; } public int Population { get; set; } public Country(string name, int population) { Name = name; Population = population; } public string GetCountryInfo() { return "Country " + Name + " has the population of " + Population + "."; } } }