Calling external method in ASP.NET MVC

How to call external method in the razor view?


To call external method defined in the C# class, we can start calling them by giving their fully qualified name (if the namespace is not imported using @using statement). 
<p> 
 @MVCTraining5.Utility.LogError.GetDate()
 </p>
Here, we are assuming that we have a static method GetDate() definiend in the LogError class that is in MVCTraining5.Utility namespace. 

No comments:

Post a Comment

How to register multiple implementations of the same interface in Asp.Net Core?

 Problem: I have services that are derived from the same interface. public interface IService { } public class ServiceA : IService { ...