Question: I have input field where user provide his phone number, like that:

```
<label for="phone" class="first-col">Phone No.:</label>
<input type="text" id="phone" />
<span class="form-hint">Proper format "8 600 00 000"</span>

```

I need to make that when user typing number in following:

```
861234567

```

It automatically added spaces in following:

```
8 612 34 567

```

Any ideas how could I achieve It? Using *Java Script* or maybe with *CSS*? Or maybe there is way to achieve It via *HTML*? I've nothing found about that.

Answer: 
You'll need to handle the different types of `TypeSyntax`es. See here: <http://sourceroslyn.io/#Microsoft.CodeAnalysis.CSharp/Syntax/TypeSyntax.cs,29171ac4ad60a546,references>

What you see in the debugger is a `SimpleNameSyntax`, which does have a public `Identifier` property.

**Update**

```
var ns = objectCreationExpressionSyntax.Type as NameSyntax;
if (ns != null)
{
  return ns.Identifier.ToString();
}

var pts = objectCreationExpressionSyntax.Type as PredefinedTypeSyntax;
if (pts != null)
{
  return pts.Keyword.ToString();
}

... 

```

All other subtypes would need to be handed. Note that `ArrayType.ElementType` is also a `TypeSyntax`, so you would most probably need to make this method recursive.
Strings can be misleading. 

Let's say you have the expression `new SomeClass()`, and you get the string "SomeClass" out of it. How do you know if that refers to `Namespace1.SomeClass` or `Namespace2.SomeClass` ? What if there is a `using SomeClass = Namespace3.SomeOtherType;` declaration being used?

Fortunately, you don't have to do this analysis yourself. The compiler can bind the ObjectCreationExpressionSyntax to a symbol. You have your semantic model, use it.

```
foreach (var oce in objectCreationExpressionSyntaxs)
{
    ITypeSymbol typeSymbol = model.GetTypeInfo(oce).Type;
    // ...
}

```

You can compare this symbol with the symbols you get from `model.GetDeclaredSymbol(classDeclarationSyntax)`, just make sure you use the `Equals` method, not the `==` operator.