Why not just create a small procedure to alter the system:
create or replace procedure change_cache_size (Px in number) is
begin
execute immediate 'alter system set db_cache_size = Xm scope=both';
end;
You can then call this from C#.
In order to find the current value of a parameter in SQL you can query V$PARAMETER
select value
from v$parameter
where name = 'db_cache_size'
This can then be queried normally. Alternatively, you can combine them into one using an OUT parameter.
create or replace procedure change_cache_size (Psize out varchar2) is
begin
execute immediate 'alter system set db_cache_size = Xm scope=both';
select value into Psize
from v$parameter
where name = 'db_cache_size';
end;
I would be extremely wary of changing an initialization parameter in an application in this manner. It's highly indicative that something needs to be changed in your database. I would be much more comfortable coming up with a cache size that works for all applications using a database rather than changing it based on the requirements of one at a single moment in time.
If you want X to be variable then simply make this another parameter:
create or replace procedure change_cache_size (PX in number, Psize out varchar2) is
begin
execute immediate 'alter system set db_cache_size = ' || X || 'm scope=both';
select value into Psize
from v$parameter
where name = 'db_cache_size';
end;
It's worth noting that you'd now be performing system changes dynamically with user input... ensure you sanitise the input first.