Question: I've come outwith this code to remove two charahcters from sentence, however I was wondering how to start counting sentence from 1 when removing characters.

```
Examplre user enters in each textfield as following:
textfield.text: Hi, thankyou 
inputlabelOne.text: 2
inputLabelTwo.text: 5       

```

My code:

```
var numberOne = Int (InputLabelOne.text)!
var numberTwo =  Int (InputLabelTwo.text)!
var text   =  textfield.text!
var num1 = numberOne
var num2 = numberTwo                 

if let oneIndex = text.index ((text.startIndex), offsetBy: 
              num1, limetedBy:(text.endIndex)) , 
              let twoIndex = text.index ((text.startIndex), offsetBy: num2, 
              limetedBy:(text.endIndex))  {

    text.remove(at: oneIndex)
    text.remove(at: twoIndex)
    outputLabel.Text = "sentence with removed letters: \(text)"       
}

```

Answer: 
Autofac can't locate non-public constructors because it uses the [DefaultConstructorFinder](https://github.com/autofac/Autofac/blob/develop/src/Autofac/Core/Activators/Reflection/DefaultConstructorFinder.cs) class which searches only for public constructors by default.

You have to create your custom implementation of the IConstructorFinder interface like this:

```
public class AllConstructorFinder : IConstructorFinder 
{ 
    private static readonly ConcurrentDictionary<Type, ConstructorInfo[]> Cache =
        new ConcurrentDictionary<Type, ConstructorInfo[]>();

    public ConstructorInfo[] FindConstructors(Type targetType)
    {
        var result = Cache.GetOrAdd(targetType,
            t => t.GetTypeInfo().DeclaredConstructors.Where(c => !c.IsStatic).ToArray());

        return result.Length > 0 ? result : throw new NoConstructorsFoundException(targetType);
    } 
} 

```

Then you have to use the `FindConstructorsWith` extension method on type registration:

```
builder.RegisterType<Customer>()
   .FindConstructorsWith(new AllConstructorFinder())
   .AsSelf();

```

The `InternalsVisibleToAttribute` can't help in this case because it affects only the compile time.
if you want to register assembly types with at least only has one public constructor then you can use Autofac `Where` extension method like this.

```
 builder.RegisterAssemblyTypes(assembly)
        .Where(t => t.GetConstructors().Length > 0) //only public constructors
        .AsImplementedInterfaces()
        .InstancePerLifetimeScope();

```

Note: `PublicOnly` extension method registers only public types.