title: Get collection of items from c# function composite c1
body: <p>I wrote a C# function that retries a list of users from Active Directory.</p>
  
  <pre><code>        public static IEnumerable&lt;string&gt; ActiveDirectoryUsersList()
          {
              string[] adPropertiesToRetrive = { "displayName", "mail", "telephoneNumber", "displayName", "mobile" };
              List&lt;string&gt; usersInfo = new List&lt;string&gt;();
              // create and return new LDAP connection with desired settings  
              DirectoryEntry myLdapConnection = new DirectoryEntry("LDAP://OU=Users,OU=OUName,OU=Groups,DC=myDomain,DC=com", null, null, AuthenticationTypes.Secure);
  
              DirectorySearcher search = new DirectorySearcher(myLdapConnection);
              search.Filter = "(&amp;(objectClass=user)(objectCategory=person))";
              foreach (var prop in adPropertiesToRetrive)
              {
                  search.PropertiesToLoad.Add(prop);
              }
  
              SearchResultCollection allUsers = search.FindAll();
  
              foreach (SearchResult user in allUsers)
              {
                  foreach (var prop in adPropertiesToRetrive)
                  {
                      var val = user.Properties[prop].Count &gt; 0 ? user.Properties[prop][0].ToString() : "-";
                      usersInfo.Add(val);
  
                  }
  
              }
              return usersInfo;
          }
  </code></pre>
  
  <p>now I want to use this in my Razor function and iterate something like this:</p>
  
  <pre><code>@foreach (var user in Fucntion("Custom.ActiveDirectoryUsersList"))
  {
      @user
  }
  </code></pre>
  
  <p>but the result of Function(string Name) is an HTML string result.
  How can i call upon the inline C# function defined to get the raw result of the function?</p>