Reputation: 3530
I'm just starting out learning C# this may be really simple but in VB i have these namespaces
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Globalization" %>
<%@ import Namespace="System.Data.SqlClient" %>
How do I go about using those namespaces in C#?
I tried
namespace System.Data
and
using System.Data
but they didn't work
Upvotes: 1
Views: 11038
Reputation: 7609
These:
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Globalization" %>
<%@ import Namespace="System.Data.SqlClient" %>
are ASP.NET page directives. They'll be the same whether your code-behind files are C# or VB.
Upvotes: 0
Reputation: 754725
Are you trying to import namespaces into an Asp.net page? If so the code you listed with a case change will work fine.
<%@ Import Namespace="System.Data"%>
If you're trying to import them into an actual .cs file then you need the "using" directive
using System.Data;
using System.Globalization;
Upvotes: 9
Reputation: 14777
using System.Data;
using System.Globalization;
using System.Data.SqlClient;
public class MyClass {}
Upvotes: 0