Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using PartialProject.objects;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Interface classObj = new Class();
- //
- Interface obj = classObj.Instance;
- Console.ReadLine();
- }
- }
- }
- namespace PartialProject.objects
- {
- public interface Interface
- {
- Interface Instance { get; }
- }
- //To make sure the autogenerated code inherits Interface
- public partial class Class : Interface
- {
- Interface Interface.Instance
- {
- get
- {
- return Instance;
- }
- }
- }
- //This is autogenerated
- public partial class Class
- {
- private Class Instance
- {
- get
- {
- return this;
- }
- }
- }
- }
- // Source: http://stackoverflow.com/questions/2606461/problem-with-interface-implementation-in-partial-classes
- // Note: Fixed stackoverflow issue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement