L
La07K
Guest
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp58
{
class Program
{
// public static Flag F=Flag.A;
static void Main(string[] args)
{
// Add(Flag.A );
// Remove(Flag.A);
// Console.WriteLine(F);
}
public static void Operation(int i)
{
IOperation op=new Impl();//Here this class may be from two different namespace.I mean in my case 2 different dll's.My requirement is at runtime it has to identify whoever is provided the implementation that piece has to execute
//Is there any way to do this.Autofac can i use here.I never tried this.Please suggest a way.
if (i == 1)
{
op.Add();
}
else if (i == 2)
{
op.Mul();
}
else if (i == 3)
{
op.Sub();
}
}
//static void Add(Flag f)
// {
// F |= f;
// }
//static void Remove(Flag f)
// {
// var s= F &f;
// }
}
//[Flags]
//public enum Flag
//{
// A = 1,
// B = 2,
// C = 4,
// D = 8
//}
}
public class Impl: IOperation
{
public void Add()
{
//Add
}
public void Sub()
{
//Add
}
public void Mul()
{
//Add
}
}
public interface IOperation
{
void Add();
void Sub();
void Mul();
}
namespace A
{
public class Impl : IOperation
{
public void Add()
{
//Add
}
public void Sub()
{
//Add
}
public void Mul()
{
//Add
}
}
}
Thanks in advance.
La07k
Coding.....................................
Continue reading...
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp58
{
class Program
{
// public static Flag F=Flag.A;
static void Main(string[] args)
{
// Add(Flag.A );
// Remove(Flag.A);
// Console.WriteLine(F);
}
public static void Operation(int i)
{
IOperation op=new Impl();//Here this class may be from two different namespace.I mean in my case 2 different dll's.My requirement is at runtime it has to identify whoever is provided the implementation that piece has to execute
//Is there any way to do this.Autofac can i use here.I never tried this.Please suggest a way.
if (i == 1)
{
op.Add();
}
else if (i == 2)
{
op.Mul();
}
else if (i == 3)
{
op.Sub();
}
}
//static void Add(Flag f)
// {
// F |= f;
// }
//static void Remove(Flag f)
// {
// var s= F &f;
// }
}
//[Flags]
//public enum Flag
//{
// A = 1,
// B = 2,
// C = 4,
// D = 8
//}
}
public class Impl: IOperation
{
public void Add()
{
//Add
}
public void Sub()
{
//Add
}
public void Mul()
{
//Add
}
}
public interface IOperation
{
void Add();
void Sub();
void Mul();
}
namespace A
{
public class Impl : IOperation
{
public void Add()
{
//Add
}
public void Sub()
{
//Add
}
public void Mul()
{
//Add
}
}
}
Thanks in advance.
La07k
Coding.....................................
Continue reading...