This is how you would do it in PowerShell which is very similar in how you would do it in in C#:
# Lets reference the assembly / GAC that we need for this
function getUsers
{
param ([string] $verify_sitepath="https://extranet.something.com")
$verify_site=new-object Microsoft.SharePoint.SPSite($verify_sitepath)
$verify_web=$verify_site.Rootweb
$verify_web.site.url
$verify_groups = $verify_web.groups | ? {$_.Name -match "^.*$CurrentGroup" }
foreach($verify_group in $verify_groups)
{
foreach($verify_user in $verify_group.users)
{
$verify_user = $verify_user -replace "WRKGRP\\",""
Write-Output "$verify_user" | Out-File -filepath "$splist$currentGroup.txt" -append
}
}
}
What this does is gets all the users from SharePoint that are in a text file. Hopefully this gets you at least thinking about how SharePoint is set up.
A great resource is the MSDN page with all the functions. They provide a lot of programming samples in C#!